Extract values in DisparityImage
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?
add a comment