What was the compile error you got originally?  That's not a valid cast to be making.<div><br></div><div>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?</div>

<div><br></div><div>Josh<br><br><div class="gmail_quote">On Fri, Nov 19, 2010 at 12:49 PM, Soonhac Hong <span dir="ltr"><<a href="mailto:soonhac.hong@gmail.com">soonhac.hong@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Hi all,<br>
<br>
I'm trying to convert sensor_msgs/Image to the opencv image. The<br>
sensor_msgs/Image is defined in the ros service as follows.<br>
<br>
<temp_srv.srv><br>
bool isColor<br>
----<br>
sensor_msgs/Image left_image<br>
<br>
<br>
The problem has happened at the following code.<br>
<br>
IplImage* left_image = bridge_.imgMsgToCv((const<br>
sensor_msgs::ImageConstPtr&) srv.response.left_image, "passthrough");<br>
<br>
Without the casting,(const sensor_msgs::ImageConstPtr&), there was an<br>
compile error. With the casting, there is a runtime error, segmentation<br>
fault. Is there anyone to know how to get the<br>
sensor_msgs::ImageConstPtr& of the sensor_msgs/Image which is defined in<br>
the ros service?<br>
<br>
I confirmed that there are the proper value of each pixel in the<br>
srv.response.left_image.data[] as well as srv.response.left_image.width<br>
and srv.response.left_image.hight.<br>
<br>
Thank you for any comments.<br>
<br>
Best,<br>
Soonhac<br>
<br>
_______________________________________________<br>
ros-users mailing list<br>
<a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a><br>
<a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
</blockquote></div><br></div>