Vision · interactive
How can a camera tell how far away something is?
Left: the two camera views, blinking left, right, left. The faint ghost marks the cyclist’s spot in the other view. Right: the same scene from above, not to scale. Drag the cyclist along the road in the top view, or tap the camera view to stop the blinking.
1 See
Close one eye, then the other, and your thumb jumps while the wall behind it stays put. A pair of cameras can turn that jump into a distance.
2 Change
3 Understand
Model notes and sources
Model. Two identical pinhole cameras sit side by side, a baseline B apart, both pointing straight ahead. A point at distance Z lands d = f·B/Z pixels further right in the left camera’s image than in the right one’s. That shift is the disparity, so the distance is Z = f·B/d. Here f is the focal length in pixels, f = (W/2)/tan(FOV/2), for an image W pixels wide. The model camera has a 44° horizontal field of view, so at 1,280 pixels wide f ≈ 1,584 px. Cameras 30 cm apart see a cyclist 10 m away shift by 1,584 × 0.30 ÷ 10 ≈ 48 px; at 3.6 m, by about 132 px. A skyline 5 km away shifts by about 0.1 px.
Depth error. A stereo matcher finds the shift only to within a fraction of a pixel; the model assumes ±0.25 px (illustrative). The distance is then uncertain by about δZ ≈ Z²·δd/(f·B). The error grows with the square of the distance and shrinks with a wider baseline or a sharper camera. The tool’s measured distance rounds the shift to the nearest 0.25 px; a shift under 0.125 px rounds to zero, and then the distance can’t be told from the skyline.
The thumb trick. Your eyes are about 6.3 cm apart (US Army survey averages: 64.0 mm for men, 61.7 mm for women). We take a thumb 2 cm wide at arm’s length, 60 cm away. Your two eyes then see it from directions 2·arctan(3.15/60) ≈ 6.0° apart, about three thumb-widths, so it jumps. A wall 4 m away shifts by about 0.9°. The film draws each eye’s view like a camera looking straight ahead, as the model does. Your brain also turns your eyes and fuses the two views, and the model leaves that out.
Fixed values and drawing. Rider and bike are 1.8 m tall, 0.8 m right of the cameras’ line of sight. The cameras are 1.6 m above the road. The road is a flat plane, so each image row below the horizon shifts by B·(row − horizon)/1.6 m, and everything above the horizon (the skyline) by f·B/5 km. The low barriers are treated as part of the road. The top view is not to scale: the baselines and angles are drawn much larger, and distance is drawn on a squeezed (logarithmic) scale. The photos (the causeway, the cyclist, the living room, the hand and the car interior) are AI-generated illustrations. The left and right views are made from one photo: the cyclist and the hand are cut from edits of it and shifted by the model’s disparity, and the road and wall behind them shift by their own disparity. Every number comes from the model.
Not modeled. Lens distortion and calibration, including rectification (lining the two images up row by row); how a matcher finds the same point in both images (smooth, shiny or repeating surfaces are hard); parts visible to only one camera; motion between frames; and the radar, single-camera cues and machine learning that many systems combine with stereo. Human depth perception also uses focus, eye convergence, motion parallax and familiar sizes.
In cars and phones. Some driver-assistance systems use a forward-facing pair of cameras behind the windshield. Subaru’s EyeSight, for example, uses two cameras mounted about a foot (30 cm) apart near the rear-view mirror. The phone preset’s 1 cm stands for two neighbouring lenses and is illustrative. Phones also estimate depth from dual-pixel sensors and machine learning.
Sources: R. Szeliski, Computer Vision: Algorithms and Applications, 2nd ed. (2022), ch. 12, Depth estimation (disparity d = f·B/Z); Computer stereo vision; Binocular disparity; Pupillary distance (2012 Anthropometric Survey of US Army Personnel); Brake & Front End, Understanding Subaru’s EyeSight System (cameras “about a foot apart”); Y. Zhang et al. (2020), Du²Net: Learning depth estimation from dual-cameras and dual-pixels (depth error grows quadratically with distance); U. Franke (2013), stereo vision for driver assistance (a few pixels of disparity at 100 m and beyond; subpixel precision “a must”).
An ExplainerTools Original.


