Ask Your Question
0

Extract values in DisparityImage

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

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;
    try
    {
        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());
        return;
    }

    imshow("Display", cv_ptr->image);
    cv::waitKey(3);
}

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
0

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

superawesomepandacat gravatar image

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

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

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

Seen: 361 times

Last updated: Mar 17 '13