Twin-lens stereo camera observing textured cubes at two different depths.

What you need

Use a calibrated, synchronized stereo pair and a textured static target. Evaluate saved rectified images before connecting a robot.

Approximate depth error for 0.5-pixel disparity error. 40-pixel disparity: 15 mm; 20-pixel disparity: 60 mm.
Approximate depth error for 0.5-pixel disparity error. Original Academy diagram using illustrative values; not a measured hardware result.
Read the diagram as a data table
Values used in the illustration
Condition or componentmm
40-pixel disparity15
20-pixel disparity60

The calculation

Z = f × B / d
|δZ| ≈ f × B × |δd| / d²

f is focal length in pixels, B is baseline in m, d is disparity in pixels and Z is m.

Worked example

Illustrative numbers. Replace them with your measured inputs.

With f=800 pixels and B=0.06 m, disparity 40 pixels gives 1.2 m depth. At 20 pixels, depth is 2.4 m. A 0.5-pixel disparity error gives approximate depth errors of 15 mm and 60 mm respectively.

Try it step by step

  1. Calibrate and rectify the pair, then inspect whether corresponding features lie on the expected epipolar lines.
  2. Evaluate matching on representative materials, including low-texture, shiny and repetitive surfaces.
  3. Reject invalid or low-confidence disparity and propagate plausible disparity uncertainty into a depth budget.
  4. Compare recovered depth with independent distances throughout the robot’s intended operating range.

How to check the result

Publish error versus distance and material rather than a single best-case depth value. Missing depth must not be silently replaced with a plausible target.

Common mistake to avoid

The formula assumes calibrated rectified geometry. Occlusions, exposure differences and asynchronous cameras can invalidate individual correspondences.

Reference reading

Primary references for the underlying models, APIs or application context. The worked numbers and plots above are educational calculations, not results reported by these sources.

Read our methods, limitations and safety notes.