Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Callback CompressedImage /w image_transport

Hello, I am trying to get the images of a kinect topic via image_transport. I added a Subscriber like this

image_transport::ImageTransport it(nh);
image_transport::TransportHints th("compressed");
image_transport::Subscriber img_sub = it.subscribe("/camera/rgb/image_raw", 1, savingImagesCb, ros::VoidPtr(), th);

my Callback:

void savingImagesCb(const sensor_msgs::CompressedImageConstPtr& msg)

It produces the compilation error:

logger.cpp:50:118:   required from here
/usr/include/boost/function/function_template.hpp:118:11: error: invalid initialization of reference of type ‘const boost::shared_ptr<const sensor_msgs::CompressedImage_<std::allocator<void> > >&’ from expression of type ‘const boost::shared_ptr<const sensor_msgs::Image_<std::allocator<void> > >’
       BOOST_FUNCTION_RETURN(f(BOOST_FUNCTION_ARGS));

I need the CompressedImage format for further processing, but image_transport won't allow this. How can I subscribe to a topic of this type (other than a normal Subscriber)?