ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Extract values in DisparityImage

asked 2013-03-17 04:33:27 -0600

superawesomepandacat gravatar image

I am trying to extract the values of certain points in a stereo_msgs::DisparityImage message. I'm assuming that the values are stored in "sensor_msgs/Image image" inside the DisparityImage message. So I did this:

void disparityrelay::callback(const stereo_msgs::DisparityImage::ConstPtr& disparity)
    cv_bridge::CvImagePtr cv_ptr;
        cv_ptr = cv_bridge::toCvCopy(disparity->image, sensor_msgs::image_encodings::TYPE_32FC1);
    catch (cv_bridge::Exception& e)
        ROS_ERROR("cv_bridge exception: %s", e.what());

    imshow("Display", cv_ptr->image);

But all I got is a black and white image. Did I do something wrong, or am I just not approaching this correctly?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-03-17 11:07:14 -0600

superawesomepandacat gravatar image

Float values need to be normalize to 0~1 so that imshow can display it.

edit flag offensive delete link more

Question Tools


Asked: 2013-03-17 04:33:27 -0600

Seen: 451 times

Last updated: Mar 17 '13