[ros-users] How do I get 2D depth map from 3D point cloud?

Patrick Mihelich mihelich at willowgarage.com
Fri May 21 22:41:53 UTC 2010


On Wed, May 19, 2010 at 1:01 AM, Chriss Lei <lei.chriss at 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<http://www.ros.org/doc/api/stereo_msgs/html/msg/DisparityImage.html>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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20100521/ea0c28b2/attachment-0003.html>


More information about the ros-users mailing list