Re: [ros-users] Convert sensor_msgs/Image to the opencv imag…

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: User discussions
Date:  
To: User discussions
Subject: Re: [ros-users] Convert sensor_msgs/Image to the opencv image
Hi Josh,

The compile error was the follows.

error: no matching function for call to
'sensor_msgs::CvBridge::imgMsgToCv(sensor_msgs::Image&, const char [12])'


Best,
Soonhac


On 11/19/2010 01:18 PM, Josh Faust wrote:
> What was the compile error you got originally? That's not a valid
> cast to be making.
>
> There's a version of fromImage that just takes the sensor_msgs/Image
> -- are you sure that srv.response.left_image is a sensor_msgs/Image?
>
> Josh
>
> On Fri, Nov 19, 2010 at 12:49 PM, Soonhac Hong <
> <mailto:soonhac.hong@gmail.com>> wrote:
>
>     Hi all,

>
>     I'm trying to convert sensor_msgs/Image to the opencv image. The
>     sensor_msgs/Image is defined in the ros service as follows.

>
>     <temp_srv.srv>
>     bool isColor
>     ----
>     sensor_msgs/Image left_image

>
>
>     The problem has happened at the following code.

>
>     IplImage* left_image = bridge_.imgMsgToCv((const
>     sensor_msgs::ImageConstPtr&) srv.response.left_image, "passthrough");

>
>     Without the casting,(const sensor_msgs::ImageConstPtr&), there was an
>     compile error. With the casting, there is a runtime error,
>     segmentation
>     fault. Is there anyone to know how to get the
>     sensor_msgs::ImageConstPtr& of the sensor_msgs/Image which is
>     defined in
>     the ros service?

>
>     I confirmed that there are the proper value of each pixel in the
>     srv.response.left_image.data[] as well as
>     srv.response.left_image.width
>     and srv.response.left_image.hight.

>
>     Thank you for any comments.

>
>     Best,
>     Soonhac

>
>     _______________________________________________
>     ros-users mailing list
>      <mailto:ros-users@code.ros.org>
>     https://code.ros.org/mailman/listinfo/ros-users

>
>
>
> _______________________________________________
> ros-users mailing list
>
> https://code.ros.org/mailman/listinfo/ros-users
>