ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

mzdunek93's profile - activity

2019-04-06 00:00:27 -0500 received badge  Student (source)
2018-11-30 14:27:15 -0500 received badge  Famous Question (source)
2017-08-17 15:55:59 -0500 received badge  Notable Question (source)
2016-10-29 03:43:31 -0500 received badge  Popular Question (source)
2016-02-24 12:05:28 -0500 asked a question Image sent over a service does not have the right image type

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?