Hi Chriss,<br><br>You can do:<br><br>bridge[2].fromImage(disparity_msg->image, "passthrough");<br>IplImage* dispImg = bridge[2].toIpl();<br><br>These methods are deprecated, but currently the easiest way to do what you want.<br>
<br>-Patrick<br><br><div class="gmail_quote">On Wed, May 19, 2010 at 7:09 PM, Chriss Lei <span dir="ltr"><<a href="mailto:lei.chriss@gmail.com">lei.chriss@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello.<br><br>I'm subscribing to three topics and trying to extract image part of DisparityImageConstPtr message and convert it to IplImage.<br><br>Here's the callback function I'm using.<br><br>    void callback(const sensor_msgs::CameraInfo::ConstPtr& info,<br>

                const sensor_msgs::ImageConstPtr& left,<br>                const stereo_msgs::DisparityImageConstPtr& disparity_msg)<br>    {<br>        K_intrinsic[0] = info->K[0];<br>        ROS_INFO("fx [%f]", K_intrinsic[0]);<br>

<br>        cerr << "f: " << disparity_msg->f << " , T: " << disparity_msg->T << endl;<br>        <br>        IplImage* im_left = bridge[1].imgMsgToCv(left, "passthrough");<br>

<br>        //const sensor_msgs::Image& disp = (disparity_msg->image);<br>        //const sensor_msgs::ImageConstPtr& dispPtr = disp;<br><br>        IplImage* dispImg = bridge[2].imgMsgToCv(disparity_msg->image, "passthrough");<br>

<br>        cvShowImage("left", im_left);<br><br>    }<br><br>Subscribing works fine (I can see the rectified image displayed) but I'm having a difficult time extracting the image member of the DisparityImageConstPtr message.<br>

<br>I have to following error:<br><br>/home/lei/ros/stacks/poseEstimation/src/vizDepthMap.cpp:79: error: no matching function for call to ‘sensor_msgs::CvBridge::imgMsgToCv(const sensor_msgs::Image&, const char [12])’<br>

/home/lei/ros/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:424: note: candidates are: IplImage* sensor_msgs::CvBridge::imgMsgToCv(boost::shared_ptr<const sensor_msgs::Image>, std::string)<br><br><br>
It seems like there's an error from cvbridge expecting ImageConstPtr as input but I'm supplying Image type.<br>
<br>Is there a way to extract and convert the disparity image from the DisparityImageConstPtr message?<br><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>
<br></blockquote></div><br>