Generating disparity in pixels from stereo_image_prc

asked 2016-06-17 10:35:59 -0600

dash95 gravatar image

updated 2016-06-17 11:07:20 -0600

I want to generate my own point cloud from disparity image published my stereo_image_proc . I am subscribing to topic /stereo/disparity . Now I am exratcting the disparity image as for further processing as :

 cv_ptr = cv_bridge::toCvCopy(disparity->image, sensor_msgs::image_encodings::TYPE_32FC1);

To calculate X,Y,Z (to generate point cloud) I need the value of disparity corresponding to to each u,v of the image pixel . I am using following formula

Z = fB/d
where
Z = distance along the camera Z axis
f = focal length (in pixels)
B = baseline (in metres)
d = disparity (in pixels)

however the disparity image I am getting is in TYPE_32FC1 format . So each pixel value is in meters(or some other units, not sure ) not in pixels. But as per my formula I want the value of d(disparity) in pixels . Can Someone help me :(

edit retag flag offensive close merge delete