[ros-users] cvbridge conversion failure

Chriss Lei lei.chriss at gmail.com
Thu May 20 02:09:32 UTC 2010


I'm subscribing to three topics and trying to extract image part of
DisparityImageConstPtr message and convert it to IplImage.

Here's the callback function I'm using.

    void callback(const sensor_msgs::CameraInfo::ConstPtr& info,
                const sensor_msgs::ImageConstPtr& left,
                const stereo_msgs::DisparityImageConstPtr& disparity_msg)
        K_intrinsic[0] = info->K[0];
        ROS_INFO("fx [%f]", K_intrinsic[0]);

        cerr << "f: " << disparity_msg->f << " , T: " << disparity_msg->T <<

        IplImage* im_left = bridge[1].imgMsgToCv(left, "passthrough");

        //const sensor_msgs::Image& disp = (disparity_msg->image);
        //const sensor_msgs::ImageConstPtr& dispPtr = disp;

        IplImage* dispImg = bridge[2].imgMsgToCv(disparity_msg->image,

        cvShowImage("left", im_left);


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.

I have to following error:

/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])’
note: candidates are: IplImage*
sensor_msgs::Image>, std::string)

It seems like there's an error from cvbridge expecting ImageConstPtr as
input but I'm supplying Image type.

Is there a way to extract and convert the disparity image from the
DisparityImageConstPtr message?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/ros-users/attachments/20100519/e3e23bb4/attachment-0002.html>

More information about the ros-users mailing list