OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Fri, 11 Mar 2016 09:07:18 -0600Disparity with 32FC1?http://answers.opencv.org/question/89361/disparity-with-32fc1/Hello,
I'm obtaining the disparity map (using a ros node) and I get that the encoding is 32FC1. How do I obtain the disparity for each pixel to obtain the depth in Z?
According to the formulas, I should do Z = f.b / d. f being the focal length, b the baseline and d the disparity. But for d in a pixel coordinate (u, v) from the rectified images I get four values (RGBA I guess). How do I get the real value for d from this four values?
Thanks for the help. Fri, 04 Mar 2016 04:59:19 -0600http://answers.opencv.org/question/89361/disparity-with-32fc1/Answer by Mathieu Barnachon for <p>Hello,</p>
<p>I'm obtaining the disparity map (using a ros node) and I get that the encoding is 32FC1. How do I obtain the disparity for each pixel to obtain the depth in Z?</p>
<p>According to the formulas, I should do Z = f.b / d. f being the focal length, b the baseline and d the disparity. But for d in a pixel coordinate (u, v) from the rectified images I get four values (RGBA I guess). How do I get the real value for d from this four values?</p>
<p>Thanks for the help. </p>
http://answers.opencv.org/question/89361/disparity-with-32fc1/?answer=89945#post-id-89945 Use the [reprojectImageTo3D](http://docs.opencv.org/3.0.0/d9/d0c/group__calib3d.html#ga1bc1152bd57d63bc524204f21fde6e02) function. The Q matrix from the stereo calibration is needed (for the baseline).Fri, 11 Mar 2016 09:07:18 -0600http://answers.opencv.org/question/89361/disparity-with-32fc1/?answer=89945#post-id-89945