Computer visionIntermediate

Stereo Vision and Disparity Maps

Stereo vision estimates depth by comparing where the same scene point appears in two camera views.

Stereo visionDepthOpenCVDisparity

Site connection

The depth estimation project compared stereo vision, SGBM, and machine learning depth models against measured distances.

Visual model

Disparity as a depth cue

Increase pixel disparity and the estimated depth drops because close objects shift more between camera views.

Interactive

Larger disparity means a closer object

Left camera
Right camera

Estimated depth index: 43. The exact unit depends on focal length and baseline calibration.

Two Views, One Point

A stereo camera setup observes the same scene from two positions separated by a baseline.

A point close to the cameras appears at noticeably different horizontal positions. A far point shifts less.

From Disparity to Depth

Disparity is the pixel difference between matching points in the left and right images. With calibration, focal length, and baseline, disparity can be converted into depth.

Block-matching methods such as SGBM estimate disparity by searching for similar image patches across the two views.

QuantityMeaning
BaselineDistance between the two cameras
Focal lengthCamera projection scale
DisparityPixel shift between matching points
DepthEstimated distance from the camera rig

Common Pitfalls

  • Skipping camera calibration.
  • Expecting textureless surfaces to match well.
  • Comparing raw depth maps without understanding their scale.
  • Assuming smoother ML depth maps are automatically more accurate.

Quick check

Quiz

If disparity increases while calibration stays fixed, what usually happens to estimated depth?
  1. It increases
  2. It decreases
  3. It becomes unrelated
  4. It always becomes zero

Nearer objects have larger disparity, so depth is inversely related to disparity.

Sources and Further Reading

Related Explainers