[ros-users] cvbridge conversion failure

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: Chriss Lei
Date:  
To: ros-users
Subject: [ros-users] cvbridge conversion failure
Hello.

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 <<
endl;


        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,
"passthrough");


        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])’
/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)


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?