On Wed, May 19, 2010 at 1:01 AM, Chriss Lei <lei.chriss@gmail.com> wrote:
I understand I get 3D point cloud from stereo_image_proc with respect to left imager optical frame.
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.)

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.

Another way is to start from the disparity image, which is inversely related to the depth map. The comments to stereo_msgs/DisparityImage 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.

Patrick