Motivation
A single perspective image does not determine distance along each viewing ray. Two cameras at different positions can constrain depth when the same scene point is identified in both images. The earlier camera chapter explained projection and why translation creates parallax; this unit derives a calibrated depth calculation and examines what can make the calculation unreliable.
A rectified camera model
Definition 3.1.1
(Rectified stereo coordinates)
Use a left camera centered at and a right camera centered at , with in meters. Their axes are parallel, they look along positive , and their images have the same focal length in pixels and the same horizontal principal point . For a scene point visible in both cameras, assume . Its horizontal pixel coordinates are
Define signed disparity . These are ideal pinhole projections; coordinates from a real pair must be calibrated and rectified before applying this simplified convention.
Theorem 3.1.2
(Depth from disparity)
Under these assumptions, and therefore
For positive , zero disparity does not represent a finite positive depth in this model; a negative disparity is inconsistent with it. A real measurement can still be zero or negative because of correspondence, calibration or measurement error.
Proof
(Subtracting the two projections)
Subtract the second projection equation from the first. The principal point cancels, and
Since , this gives . Multiplying by (legitimate because ) gives . Finally, the first projection equation reads , so .
Proof X-ray
What cancels, and what does not
Three hypotheses carry the argument: the two cameras differ only by the translation along the axis (this produces the shift ), they share the same focal length , and they share the same principal point . The one non-obvious move is to subtract rather than to solve each equation for : the unknown disappears and a single equation in the single unknown remains. The argument closes because is strictly positive, so dividing by is always allowed.
If the right camera had a different focal length or principal point , the difference would be
which still contains . Then alone no longer determines . Changing the camera geometry without updating the equations is therefore not justified merely because the images look aligned.
If vertical intrinsics are equal and the vertical principal point is , both images also have . Thus the same point lies on a common image row in these rectified coordinates. This row condition narrows the search but does not identify the correct pixel by itself. Outside this simple model, rectification is an image-coordinate transformation based on camera calibration, with its own resampling and validity limits.
A complete numerical reconstruction
Worked example 3.1.3
(Depth and horizontal position)
Let pixels, meters, pixels, and matched coordinates , pixels. The disparity is pixels and pixel-meters. Hence meters and meters. Projection back into the right camera gives , agreeing with the observation. The calculation needs a genuine correspondence, not just any two pixels with the stated numerical difference.
Sensitivity and uncertainty
For a fixed calibrated , the derivative is
At small positive disparity, the same absolute disparity error creates a larger depth change. A derivative provides a local approximation, not a guaranteed error interval. For an explicit bound, if is known to lie in with , monotonicity gives
Worked example 3.1.4
(A half-pixel disparity interval)
In the previous example, suppose the true disparity lies between and pixels. Then depth lies in meters, approximately . This interval assumes and are exact and the correct pair was matched. An interval reaching zero disparity cannot give a finite upper depth bound from this formula alone.
The width of this interval depends strongly on the disparity itself, as the next example shows.
Worked example 3.1.5
(The same half-pixel error at small disparity)
Keep pixels and meters, so pixel-meters, but now let the measured disparity be pixel. Then meters. If the true disparity lies in , then meters, an interval of width meters, compared with about meters at . In the edge case where the interval is , the lower bound meters still holds, but there is no finite upper bound, because can be arbitrarily close to . The interval formula requires .
Concept lensAlgebraic
Disparity is inverse depth in pixel units
The relation can be written : disparity is proportional to inverse depth, with the constant fixed by calibration. Equal disparity steps are therefore equal steps in , which are longer and longer steps in as the point recedes. Zero disparity corresponds to , a point at infinity, which the finite model excludes.
Common mistake
(Treating equal disparity errors as equal depth errors)
Because is not linear in , a one-pixel error means different things at different disparities. With pixel-meters, changing from to changes from to meters, a change of about meters. Changing from to changes from to meters, a change of meters. A fixed pixel tolerance gives a fixed depth tolerance only locally, and distant points are far more sensitive.
Counterexample mode
One row is not one correspondence
Claim: if a left pixel and a right pixel lie on the same row and look identical, they are projections of the same scene point. Take the setting of the first example (, , ) and a row containing identical vertical stripes at , and in the right image, with the left image showing a stripe at . Matching to gives and meters, with meters. Matching to gives and meters, with meters. Both candidates are consistent with the model, yet they place the point at different depths, so appearance and row alone cannot decide. The candidate gives and is excluded by the model, and a candidate with would give a negative disparity and is excluded as well. Row alignment is necessary under the rectified model, not sufficient. Matching needs additional evidence, and a system should be able to mark a point as uncertain or unmatched. A textureless patch presents a similar ambiguity.
Visibility and practical limits
A point visible to one camera can be hidden from the other by a foreground object. Such an occlusion has no valid two-image match even with perfect calibration. A left–right consistency check can reject some mismatches, but does not prove that every remaining match is correct. Repeated patterns, reflections, illumination changes and subpixel estimation also affect the match. Increasing baseline can increase disparity for a fixed depth, but changes occlusion and field-of-view overlap; it is not a free improvement in every scene.
Disparity is measured in the same pixel coordinate convention as . A focal length in millimeters must be converted using the image scale before inserting a pixel disparity. The returned depth has the same length unit as . These rules prevent an apparently plausible numerical answer with inconsistent units.
Common mistake
(Inserting a focal length in millimeters with a disparity in pixels)
Suppose a lens has focal length mm and the sensor pixel pitch is mm, so that pixels. With meters and pixels, using directly gives meters, which is wrong by a factor of . The correct value is meters. The focal length must be converted to pixels before it is combined with a pixel disparity.
Exercises
Quick check
(With pixels, meters and pixels, find . If and , find .)
Use first, then the formula for .
Solution · Answer
meters and meters.
Quick check
(For pixel-meters and disparity in pixels, give an exact interval for .)
Depth is a decreasing function of positive disparity.
Solution · Answer
Since depth decreases as positive disparity increases, meters.
Quick check
(Under the stated convention, what can be concluded from a measured disparity of zero? Does it prove that a real object is infinitely far away?)
Compare the measurement with what the ideal model allows.
Solution · Answer
No finite positive depth produces zero disparity in the ideal model. A measured zero can reflect resolution, noise or a mismatch, so it does not prove that a real object is infinitely far away.
Quick check
(Explain why a correct image row alone does not prove a correct correspondence. Give two independent causes of failure.)
Think of what the row constraint leaves undecided.
Solution · Answer
Repeated texture can produce several plausible candidates on that row, while occlusion can remove the true match entirely. A row constraint does not decide between these situations.
Further study
General epipolar geometry, calibration uncertainty, robust correspondence, lens distortion and multi-view reconstruction require additional derivations. This unit does not implement a stereo matcher or certify the accuracy of a depth map.