Image sent over a service does not have the right image type

asked 2016-02-24 10:44:32 -0500

mzdunek93 gravatar image

I have a service which contains sensor_msgs/Image image as one of its arguments. In a callback, I try to convert this image using cv_bridge::toCvShare(req.image);. However, I receive the following error during the compilation:

error: no matching function for call to ‘toCvShare(TAPAS::SegmentImageRequest_<std::allocator<void> >::_image_type&)’
  cv_bridge::CvImageConstPtr cv_ptr = cv_bridge::toCvShare(req.image);

/opt/ros/jade/include/cv_bridge/cv_bridge.h:240:17: note: cv_bridge::CvImageConstPtr cv_bridge::toCvShare(const Image&, const boost::shared_ptr<const void>&, const string&)
 CvImageConstPtr toCvShare(const sensor_msgs::Image& source,

In other words, the type of the image sent over the service is TAPAS::SegmentImageRequest_<std::allocator<void> >::_image_type& instead of sensor_msgs::Image&. How can I convert it from the first type to the second type?

edit retag flag offensive close merge delete