ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

Hi lilouch,

there are some steps you have to do before obtaining the depth image or the pointcloud (what do you prefer?)

  1. Publish the images as ROS topics: Write a node to do that, or use one already available. For instance this one. You'll need two instances of this same node, one for the left camera and one for the right.
  2. Run stereo_image_proc to rectify the images and calculate their disparity. This node calculates also the pointcloud. From the pointcloud you've already got the depth, but in case you need a depth image, read below:

As you may already know, depth can be calculated from disparity using Z = fB/d, where f is the focal lenght (px), B is the baseline (m) and d is the disparity (px). Z is depth in m. Both f and B are fixed terms, so your entire disparity image inverted (termwise), multiplied by a constant is your depth image.