On Wed, May 19, 2010 at 1:01 AM, Chriss Lei <span dir="ltr"><<a href="mailto:lei.chriss@gmail.com">lei.chriss@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I understand I get 3D point cloud from stereo_image_proc with respect to left imager optical frame.<br>
Now, I'm interested in getting 2D depth map with pixel values set equal to depth of the point cloud. (No. I do NOT want disparity map.)<br></blockquote><div><br>Radu's suggestion (just pull Z out of the point cloud) is very simple. The only complication is that sensor_msgs/PointCloud doesn't store the points in 2d image layout, so you'll also have to look up the pixel coordinates in the "channels" field.<br>
<br>Another way is to start from the disparity image, which is inversely related to the depth map. The comments to <a href="http://www.ros.org/doc/api/stereo_msgs/html/msg/DisparityImage.html">stereo_msgs/DisparityImage</a> explain the math. Given disparity d, focal length f and baseline T, the depth is Z = fT/d. You also need to check whether d < min_disparity, which indicates an invalid disparity and hence unknown depth.<br>
<br>Patrick<br></div></div>