diff --git a/rover/rover_camera/CMakeLists.txt b/rover/rover_camera/CMakeLists.txt
new file mode 100644
index 0000000..59d3782
--- /dev/null
+++ b/rover/rover_camera/CMakeLists.txt
@@ -0,0 +1,29 @@
+cmake_minimum_required(VERSION 2.8)
+project(rover_camera)
+
+find_package(catkin REQUIRED COMPONENTS cv_bridge image_transport message_generation sensor_msgs)
+
+# add the resized image message
+
+catkin_package(CATKIN_DEPENDS cv_bridge image_transport message_runtime sensor_msgs)
+
+find_package(OpenCV)
+
+include_directories(include ${catkin_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS})
+
+# add the publisher example
+add_executable(rover_camera src/rover_camera.cpp)
+add_dependencies(rover_camera ${catkin_EXPORTED_TARGETS} ${${PROJECT_NAME}_EXPORTED_TARGETS})
+target_link_libraries(rover_camera ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
+
+
+# Mark executables and/or libraries for installation
+install(TARGETS rover_camera
+ ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
+ LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
+ RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
+)
+
+#install(FILES resized_plugins.xml
+# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
+#)
diff --git a/rover/rover_camera/launch/example.launch b/rover/rover_camera/launch/example.launch
new file mode 100644
index 0000000..93e36bc
--- /dev/null
+++ b/rover/rover_camera/launch/example.launch
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/rover/tutorial/package.xml b/rover/rover_camera/package.xml
similarity index 59%
rename from rover/tutorial/package.xml
rename to rover/rover_camera/package.xml
index 668cd0a..7456332 100644
--- a/rover/tutorial/package.xml
+++ b/rover/rover_camera/package.xml
@@ -1,9 +1,9 @@
- image_transport_tutorial
+ rover_camera
0.0.0
- Tutorial for image_transport. This is useful for the tutorials at http://wiki.ros.org/image_transport/Tutorials/
- Vincent Rabaud
- Vincent Rabaud
+ This package opens a camera on linux using OpenCV and publishes multiple streams at different resolutions
+ Corwin Perren
+ Corwin Perren
Apache 2.0
cv_bridge
@@ -20,7 +20,4 @@
catkin
-
-
-
diff --git a/rover/tutorial/src/my_publisher.cpp b/rover/rover_camera/src/rover_camera.cpp
similarity index 95%
rename from rover/tutorial/src/my_publisher.cpp
rename to rover/rover_camera/src/rover_camera.cpp
index 60f8ec9..38ec853 100644
--- a/rover/tutorial/src/my_publisher.cpp
+++ b/rover/rover_camera/src/rover_camera.cpp
@@ -13,23 +13,23 @@ int main(int argc, char** argv)
{
std::string capture_device_path;
int fps;
-
+
int large_image_width;
int large_image_height;
int small_image_width;
int small_image_height;
-
+
ros::init(argc, argv, "camera");
ros::NodeHandle node_handle("~");
-
+
node_handle.param("device_path", capture_device_path, std::string("/dev/video0"));
node_handle.param("fps", fps, 30);
-
+
node_handle.param("large_image_width", large_image_width, 1280);
node_handle.param("large_image_height", large_image_height, 720);
node_handle.param("small_image_width", small_image_width, 640);
node_handle.param("small_image_height", small_image_height, 360);
-
+
cv::VideoCapture cap(capture_device_path);
cap.set(CV_CAP_PROP_FOURCC, CV_FOURCC('M', 'J', 'P', 'G'));
@@ -40,10 +40,10 @@ int main(int argc, char** argv)
if(cap.isOpened() == false){
return -1;
}
-
+
image_transport::ImageTransport full_res_image_transport(node_handle);
image_transport::ImageTransport lower_res_image_transport(node_handle);
-
+
image_transport::Publisher full_size_publisher = full_res_image_transport.advertise("image_720p", 1);
image_transport::Publisher lower_size_publisher = lower_res_image_transport.advertise("image_360p", 1);
@@ -51,24 +51,23 @@ int main(int argc, char** argv)
cv::Mat image_smaller;
ros::Rate loop_rate(fps + 5);
-
-
+
+
while (node_handle.ok()) {
-
+
cap.read(image);
-
+
if(!image.empty()){
cv::resize(image, image_smaller, cv::Size(small_image_width, small_image_height));
-
+
sensor_msgs::ImagePtr full_res_message = cv_bridge::CvImage(std_msgs::Header(), "bgr8", image).toImageMsg();
sensor_msgs::ImagePtr lower_res_message = cv_bridge::CvImage(std_msgs::Header(), "bgr8", image_smaller).toImageMsg();
-
+
full_size_publisher.publish(full_res_message);
lower_size_publisher.publish(lower_res_message);
}
-
+
ros::spinOnce();
loop_rate.sleep();
}
}
-
diff --git a/rover/rover_cameras/CMakeLists.txt b/rover/rover_cameras/CMakeLists.txt
deleted file mode 100644
index d0422e7..0000000
--- a/rover/rover_cameras/CMakeLists.txt
+++ /dev/null
@@ -1,197 +0,0 @@
-cmake_minimum_required(VERSION 2.8.3)
-project(rover_cameras)
-
-## Compile as C++11, supported in ROS Kinetic and newer
-# add_compile_options(-std=c++11)
-
-## Find catkin macros and libraries
-## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
-## is used, also find other catkin packages
-find_package(catkin REQUIRED COMPONENTS
- rospy
-)
-
-## System dependencies are found with CMake's conventions
-# find_package(Boost REQUIRED COMPONENTS system)
-
-
-## Uncomment this if the package has a setup.py. This macro ensures
-## modules and global scripts declared therein get installed
-## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
-# catkin_python_setup()
-
-################################################
-## Declare ROS messages, services and actions ##
-################################################
-
-## To declare and build messages, services or actions from within this
-## package, follow these steps:
-## * Let MSG_DEP_SET be the set of packages whose message types you use in
-## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
-## * In the file package.xml:
-## * add a build_depend tag for "message_generation"
-## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET
-## * If MSG_DEP_SET isn't empty the following dependency has been pulled in
-## but can be declared for certainty nonetheless:
-## * add a run_depend tag for "message_runtime"
-## * In this file (CMakeLists.txt):
-## * add "message_generation" and every package in MSG_DEP_SET to
-## find_package(catkin REQUIRED COMPONENTS ...)
-## * add "message_runtime" and every package in MSG_DEP_SET to
-## catkin_package(CATKIN_DEPENDS ...)
-## * uncomment the add_*_files sections below as needed
-## and list every .msg/.srv/.action file to be processed
-## * uncomment the generate_messages entry below
-## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)
-
-## Generate messages in the 'msg' folder
-# add_message_files(
-# FILES
-# Message1.msg
-# Message2.msg
-# )
-
-## Generate services in the 'srv' folder
-# add_service_files(
-# FILES
-# Service1.srv
-# Service2.srv
-# )
-
-## Generate actions in the 'action' folder
-# add_action_files(
-# FILES
-# Action1.action
-# Action2.action
-# )
-
-## Generate added messages and services with any dependencies listed here
-# generate_messages(
-# DEPENDENCIES
-# std_msgs # Or other packages containing msgs
-# )
-
-################################################
-## Declare ROS dynamic reconfigure parameters ##
-################################################
-
-## To declare and build dynamic reconfigure parameters within this
-## package, follow these steps:
-## * In the file package.xml:
-## * add a build_depend and a run_depend tag for "dynamic_reconfigure"
-## * In this file (CMakeLists.txt):
-## * add "dynamic_reconfigure" to
-## find_package(catkin REQUIRED COMPONENTS ...)
-## * uncomment the "generate_dynamic_reconfigure_options" section below
-## and list every .cfg file to be processed
-
-## Generate dynamic reconfigure parameters in the 'cfg' folder
-# generate_dynamic_reconfigure_options(
-# cfg/DynReconf1.cfg
-# cfg/DynReconf2.cfg
-# )
-
-###################################
-## catkin specific configuration ##
-###################################
-## The catkin_package macro generates cmake config files for your package
-## Declare things to be passed to dependent projects
-## INCLUDE_DIRS: uncomment this if your package contains header files
-## LIBRARIES: libraries you create in this project that dependent projects also need
-## CATKIN_DEPENDS: catkin_packages dependent projects also need
-## DEPENDS: system dependencies of this project that dependent projects also need
-catkin_package(
-# INCLUDE_DIRS include
-# LIBRARIES rover_cameras
-# CATKIN_DEPENDS rospy
-# DEPENDS system_lib
-)
-
-###########
-## Build ##
-###########
-
-## Specify additional locations of header files
-## Your package locations should be listed before other locations
-include_directories(
-# include
- ${catkin_INCLUDE_DIRS}
-)
-
-## Declare a C++ library
-# add_library(${PROJECT_NAME}
-# src/${PROJECT_NAME}/rover_cameras.cpp
-# )
-
-## Add cmake target dependencies of the library
-## as an example, code may need to be generated before libraries
-## either from message generation or dynamic reconfigure
-# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
-
-## Declare a C++ executable
-## With catkin_make all packages are built within a single CMake context
-## The recommended prefix ensures that target names across packages don't collide
-# add_executable(${PROJECT_NAME}_node src/rover_cameras_node.cpp)
-
-## Rename C++ executable without prefix
-## The above recommended prefix causes long target names, the following renames the
-## target back to the shorter version for ease of user use
-## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
-# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")
-
-## Add cmake target dependencies of the executable
-## same as for the library above
-# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
-
-## Specify libraries to link a library or executable target against
-# target_link_libraries(${PROJECT_NAME}_node
-# ${catkin_LIBRARIES}
-# )
-
-#############
-## Install ##
-#############
-
-# all install targets should use catkin DESTINATION variables
-# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
-
-## Mark executable scripts (Python etc.) for installation
-## in contrast to setup.py, you can choose the destination
-# install(PROGRAMS
-# scripts/my_python_script
-# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
-# )
-
-## Mark executables and/or libraries for installation
-# install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node
-# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
-# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
-# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
-# )
-
-## Mark cpp header files for installation
-# install(DIRECTORY include/${PROJECT_NAME}/
-# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
-# FILES_MATCHING PATTERN "*.h"
-# PATTERN ".svn" EXCLUDE
-# )
-
-## Mark other files for installation (e.g. launch and bag files, etc.)
-# install(FILES
-# # myfile1
-# # myfile2
-# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
-# )
-
-#############
-## Testing ##
-#############
-
-## Add gtest based cpp test target and link libraries
-# catkin_add_gtest(${PROJECT_NAME}-test test/test_rover_cameras.cpp)
-# if(TARGET ${PROJECT_NAME}-test)
-# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
-# endif()
-
-## Add folders to be run by python nosetests
-# catkin_add_nosetests(test)
diff --git a/rover/rover_cameras/launch/camera_launches/gimbal/gimbal_camera_360p.launch b/rover/rover_cameras/launch/camera_launches/gimbal/gimbal_camera_360p.launch
deleted file mode 100644
index b3599e2..0000000
--- a/rover/rover_cameras/launch/camera_launches/gimbal/gimbal_camera_360p.launch
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/rover/rover_cameras/launch/camera_launches/gimbal/gimbal_camera_720p.launch b/rover/rover_cameras/launch/camera_launches/gimbal/gimbal_camera_720p.launch
deleted file mode 100644
index 754fd87..0000000
--- a/rover/rover_cameras/launch/camera_launches/gimbal/gimbal_camera_720p.launch
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/rover/rover_cameras/launch/camera_launches/main_navigation/main_navigation_camera_360p.launch b/rover/rover_cameras/launch/camera_launches/main_navigation/main_navigation_camera_360p.launch
deleted file mode 100644
index 092db23..0000000
--- a/rover/rover_cameras/launch/camera_launches/main_navigation/main_navigation_camera_360p.launch
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/rover/rover_cameras/launch/camera_launches/main_navigation/main_navigation_camera_720p.launch b/rover/rover_cameras/launch/camera_launches/main_navigation/main_navigation_camera_720p.launch
deleted file mode 100644
index e3df6b0..0000000
--- a/rover/rover_cameras/launch/camera_launches/main_navigation/main_navigation_camera_720p.launch
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/rover/rover_cameras/launch/camera_launches/undercarriage/undercarriage_camera_360p.launch b/rover/rover_cameras/launch/camera_launches/undercarriage/undercarriage_camera_360p.launch
deleted file mode 100644
index 0e21498..0000000
--- a/rover/rover_cameras/launch/camera_launches/undercarriage/undercarriage_camera_360p.launch
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/rover/rover_cameras/launch/camera_launches/undercarriage/undercarriage_camera_720p.launch b/rover/rover_cameras/launch/camera_launches/undercarriage/undercarriage_camera_720p.launch
deleted file mode 100644
index 51ed160..0000000
--- a/rover/rover_cameras/launch/camera_launches/undercarriage/undercarriage_camera_720p.launch
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/rover/rover_cameras/package.xml b/rover/rover_cameras/package.xml
deleted file mode 100644
index b12fd0c..0000000
--- a/rover/rover_cameras/package.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
- rover_cameras
- 0.0.0
- The rover_cameras package
-
-
-
-
- nvidia
-
-
-
-
-
- TODO
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- catkin
- rospy
- rospy
- rospy
-
-
-
-
-
-
-
-
diff --git a/rover/tutorial/CMakeLists.txt b/rover/tutorial/CMakeLists.txt
deleted file mode 100644
index b40fe74..0000000
--- a/rover/tutorial/CMakeLists.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-cmake_minimum_required(VERSION 2.8)
-project(image_transport_tutorial)
-
-find_package(catkin REQUIRED COMPONENTS cv_bridge image_transport message_generation sensor_msgs)
-
-# add the resized image message
-add_message_files(DIRECTORY msg
- FILES ResizedImage.msg
-)
-generate_messages(DEPENDENCIES sensor_msgs)
-
-catkin_package(CATKIN_DEPENDS cv_bridge image_transport message_runtime sensor_msgs)
-
-find_package(OpenCV)
-
-include_directories(include ${catkin_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS})
-
-# add the publisher example
-add_executable(my_publisher src/my_publisher.cpp)
-add_dependencies(my_publisher ${catkin_EXPORTED_TARGETS} ${${PROJECT_NAME}_EXPORTED_TARGETS})
-target_link_libraries(my_publisher ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
-
-# add the subscriber example
-#add_executable(my_subscriber src/my_subscriber.cpp)
-#add_dependencies(my_subscriber ${catkin_EXPORTED_TARGETS} ${${PROJECT_NAME}_EXPORTED_TARGETS})
-#target_link_libraries(my_subscriber ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
-
-# add the plugin example
-#add_library(resized_publisher src/manifest.cpp src/resized_publisher.cpp src/resized_subscriber.cpp)
-#add_dependencies(resized_publisher ${catkin_EXPORTED_TARGETS} ${${PROJECT_NAME}_EXPORTED_TARGETS})
-#target_link_libraries(resized_publisher ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
-
-
-# Mark executables and/or libraries for installation
-install(TARGETS my_publisher
- ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
- LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
- RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
-)
-
-#install(FILES resized_plugins.xml
-# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
-#)
diff --git a/rover/tutorial/include/image_transport_tutorial/resized_publisher.h b/rover/tutorial/include/image_transport_tutorial/resized_publisher.h
deleted file mode 100644
index 63ab3eb..0000000
--- a/rover/tutorial/include/image_transport_tutorial/resized_publisher.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#include
-#include
-
-class ResizedPublisher : public image_transport::SimplePublisherPlugin
-{
-public:
- virtual std::string getTransportName() const
- {
- return "resized";
- }
-
-protected:
- virtual void publish(const sensor_msgs::Image& message,
- const PublishFn& publish_fn) const;
-};
diff --git a/rover/tutorial/include/image_transport_tutorial/resized_subscriber.h b/rover/tutorial/include/image_transport_tutorial/resized_subscriber.h
deleted file mode 100644
index 94b55f5..0000000
--- a/rover/tutorial/include/image_transport_tutorial/resized_subscriber.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#include
-#include
-
-class ResizedSubscriber : public image_transport::SimpleSubscriberPlugin
-{
-public:
- virtual ~ResizedSubscriber() {}
-
- virtual std::string getTransportName() const
- {
- return "resized";
- }
-
-protected:
- virtual void internalCallback(const typename image_transport_tutorial::ResizedImage::ConstPtr& message,
- const Callback& user_cb);
-};
diff --git a/rover/tutorial/msg/ResizedImage.msg b/rover/tutorial/msg/ResizedImage.msg
deleted file mode 100644
index d8c8fad..0000000
--- a/rover/tutorial/msg/ResizedImage.msg
+++ /dev/null
@@ -1,3 +0,0 @@
-uint32 original_height
-uint32 original_width
-sensor_msgs/Image image
diff --git a/rover/tutorial/resized_plugins.xml b/rover/tutorial/resized_plugins.xml
deleted file mode 100644
index bd2dff1..0000000
--- a/rover/tutorial/resized_plugins.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
- This plugin publishes a decimated version of the image.
-
-
-
-
-
- This plugin rescales a decimated image to its original size.
-
-
-
diff --git a/rover/tutorial/src/manifest.cpp b/rover/tutorial/src/manifest.cpp
deleted file mode 100644
index ab20819..0000000
--- a/rover/tutorial/src/manifest.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#include
-#include
-#include
-
-PLUGINLIB_EXPORT_CLASS(ResizedPublisher, image_transport::PublisherPlugin)
-
-PLUGINLIB_EXPORT_CLASS(ResizedSubscriber, image_transport::SubscriberPlugin)
diff --git a/rover/tutorial/src/my_subscriber.cpp b/rover/tutorial/src/my_subscriber.cpp
deleted file mode 100644
index b6310f4..0000000
--- a/rover/tutorial/src/my_subscriber.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-#include
-#include
-#include
-#include
-
-void imageCallback(const sensor_msgs::ImageConstPtr& msg)
-{
- try
- {
- cv::imshow("view", cv_bridge::toCvShare(msg, "bgr8")->image);
- cv::waitKey(10);
- }
- catch (cv_bridge::Exception& e)
- {
- ROS_ERROR("Could not convert from '%s' to 'bgr8'.", msg->encoding.c_str());
- }
-}
-
-int main(int argc, char **argv)
-{
- ros::init(argc, argv, "image_listener");
- ros::NodeHandle nh;
- cv::namedWindow("view");
- cv::startWindowThread();
- image_transport::ImageTransport it(nh);
- image_transport::Subscriber sub = it.subscribe("camera/image", 1, imageCallback);
- ros::spin();
- cv::destroyWindow("view");
-}
diff --git a/rover/tutorial/src/resized_publisher.cpp b/rover/tutorial/src/resized_publisher.cpp
deleted file mode 100644
index 178f482..0000000
--- a/rover/tutorial/src/resized_publisher.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#include
-#include
-#include
-
-void ResizedPublisher::publish(const sensor_msgs::Image& message,
- const PublishFn& publish_fn) const
-{
- cv::Mat cv_image;
- boost::shared_ptr tracked_object;
- try
- {
- cv_image = cv_bridge::toCvShare(message, tracked_object, message.encoding)->image;
- }
- catch (cv::Exception &e)
- {
- ROS_ERROR("Could not convert from '%s' to '%s'.", message.encoding.c_str(), message.encoding.c_str());
- return;
- }
-
- // Retrieve subsampling factor from the parameter server
- double subsampling_factor;
- std::string param_name;
- nh().param("resized_image_transport_subsampling_factor", subsampling_factor, 2.0);
-
- // Rescale image
- int new_width = cv_image.cols / subsampling_factor + 0.5;
- int new_height = cv_image.rows / subsampling_factor + 0.5;
- cv::Mat buffer;
- cv::resize(cv_image, buffer, cv::Size(new_width, new_height));
-
- // Set up ResizedImage and publish
- image_transport_tutorial::ResizedImage resized_image;
- resized_image.original_height = cv_image.rows;
- resized_image.original_width = cv_image.cols;
- resized_image.image = *(cv_bridge::CvImage(message.header, "bgr8", cv_image).toImageMsg());
- publish_fn(resized_image);
-}
diff --git a/rover/tutorial/src/resized_subscriber.cpp b/rover/tutorial/src/resized_subscriber.cpp
deleted file mode 100644
index 299dc83..0000000
--- a/rover/tutorial/src/resized_subscriber.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#include
-#include
-#include
-
-void ResizedSubscriber::internalCallback(const image_transport_tutorial::ResizedImage::ConstPtr& msg,
- const Callback& user_cb)
-{
- // This is only for optimization, not to copy the image
- boost::shared_ptr tracked_object_tmp;
- cv::Mat img_rsz = cv_bridge::toCvShare(msg->image, tracked_object_tmp)->image;
- // Resize the image to its original size
- cv::Mat img_restored;
- cv::resize(img_rsz, img_restored, cv::Size(msg->original_width, msg->original_height));
-
- // Call the user callback with the restored image
- cv_bridge::CvImage cv_img(msg->image.header, msg->image.encoding, img_restored);
- user_cb(cv_img.toImageMsg());
-};