resized_subscriber.cpp
Go to the documentation of this file.
00001 #include <image_transport_tutorial/resized_subscriber.h>
00002 #include <cv_bridge/cv_bridge.h>
00003 #include <opencv2/imgproc/imgproc.hpp>
00004 
00005 void ResizedSubscriber::internalCallback(const image_transport_tutorial::ResizedImage::ConstPtr& msg,
00006                                          const Callback& user_cb)
00007 {
00008   // This is only for optimization, not to copy the image
00009   boost::shared_ptr<void const> tracked_object_tmp;
00010   cv::Mat img_rsz = cv_bridge::toCvShare(msg->image, tracked_object_tmp)->image;
00011   // Resize the image to its original size
00012   cv::Mat img_restored;
00013   cv::resize(img_rsz, img_restored, cv::Size(msg->original_width, msg->original_height));
00014 
00015   // Call the user callback with the restored image
00016   cv_bridge::CvImage cv_img(msg->image.header, msg->image.encoding, img_restored);
00017   user_cb(cv_img.toImageMsg());
00018 };


image_transport
Author(s): Patrick Mihelich
autogenerated on Thu Aug 27 2015 13:30:17