← Computer Vision for EveryoneToolsInVisionLearning Center
Depth, Recognition, and Evaluation · Lesson 9

Stereo Vision and Depth

Hold a finger in front of your face and alternate which eye is open.

Watch the lesson

Stereo Vision and Depth explained visually

1:55

Hold a finger in front of your face and alternate which eye is open. English captions are optional and start off. The complete transcript follows the written lesson.

Lesson overview

What you will learn

Hold a finger in front of your face and alternate which eye is open.

  1. Two views provide a clue
  2. Match the same point
  3. Depth uncertainty grows
  4. A worked example
01

Two views provide a clue

Hold a finger in front of your face and alternate which eye is open. Its apparent position changes. Stereo vision uses a similar difference between two camera views to estimate depth. The sideways separation of corresponding image points is called disparity. The camera geometry must be known, and the correspondence must refer to the same physical point.

02

Match the same point

For a simplified rectified stereo pair, depth equals focal length times camera baseline divided by disparity. Larger disparity usually indicates a closer point. The units must be consistent: focal length may be expressed in pixels, disparity in pixels, and baseline in meters. A disparity error of one pixel matters much more when the true disparity is only a few pixels than when it is large.

03

Depth uncertainty grows

Textureless surfaces, repeated patterns, reflections, and occlusions make correspondence difficult. Some points visible to one camera are not visible to the other. A depth map should therefore include a way to identify unreliable or missing estimates. Monocular learned depth uses a different source of information: patterns learned from training examples. Its numerical scale depends on the model and setup and should not be assumed to equal calibrated metric depth.

04

A worked example

With focal length eight hundred pixels, baseline zero point one meters, and disparity twenty pixels, the simplified depth estimate is four meters. At a disparity of ten pixels, it becomes eight meters. This inverse relationship explains why distant-depth estimates are sensitive to small disparity errors.

Worked example

With focal length 800 pixels, baseline 0.1 meters, and disparity 20 pixels, the simplified depth estimate is four meters. At a disparity of ten pixels, it becomes eight meters. This inverse relationship explains why distant-depth estimates are sensitive to small disparity errors.

Knowledge check

Quick check: test your understanding

Try it yourself: Using the same focal length and baseline, calculate depth at disparity 40 pixels.

Check the reasoning

Eight hundred times 0.1 divided by 40 equals two meters.

Does a dense-looking depth image guarantee reliable measurements everywhere?

No. Display interpolation or model prediction can make unreliable areas look complete.

How would you solve the practice case?

Eight hundred times 0.1 divided by 40 equals two meters.

What does the worked example show?

With focal length 800 pixels, baseline 0.1 meters, and disparity 20 pixels, the simplified depth estimate is four meters. At a disparity of ten pixels, it becomes eight meters. This inverse relationship explains why distant-depth estimates are sensitive to small disparity errors.

Further reading

Programming Computer Vision with Python — Jan Erik Solem.

Original ToolsInVision teaching examples. Editorial approach · Suggest a correction

Accessible referenceLesson 9 transcript236 words · Video transcript · Matches the published narration and captionsOpen transcript

Hold a finger in front of your face and alternate which eye is open. Its apparent position changes. Stereo vision uses a similar difference between two camera views to estimate depth. The sideways separation of corresponding image points is called disparity. The camera geometry must be known, and the correspondence must refer to the same physical point.

For a simplified rectified stereo pair, depth equals focal length times camera baseline divided by disparity. Larger disparity usually indicates a closer point. The units must be consistent: focal length may be expressed in pixels, disparity in pixels, and baseline in meters. A disparity error of one pixel matters much more when the true disparity is only a few pixels than when it is large.

Textureless surfaces, repeated patterns, reflections, and occlusions make correspondence difficult. Some points visible to one camera are not visible to the other. A depth map should therefore include a way to identify unreliable or missing estimates. Monocular learned depth uses a different source of information: patterns learned from training examples. Its numerical scale depends on the model and setup and should not be assumed to equal calibrated metric depth.

With focal length eight hundred pixels, baseline zero point one meters, and disparity twenty pixels, the simplified depth estimate is four meters. At a disparity of ten pixels, it becomes eight meters. This inverse relationship explains why distant-depth estimates are sensitive to small disparity errors.