POST 05 / 07DEPTH~7 min read

Stereo Vision & Disparity

Two cameras, one scene. The shift between the two views — disparity — is inversely proportional to depth. Drag the object closer and watch disparity grow. Squint at the canvases and see in 3D yourself.

Nishanth Vanipenta2026.05.01Interactive · 1 viz

Two eyes, one depth

depth = f · B / d

Where f is focal length (in pixels), B is the baseline (distance between cameras), and d is the disparity (how far the same point shifts between left and right images).

Stereo's biggest weakness: untextured surfaces. If both images see the same blank wall, you can't match anything → no disparity → no depth. This is why structured-light projects a known pattern onto the scene.

Visualizer · stereo pair

Move the object slider to bring it closer/farther. The two camera views show the same scene from slightly different angles. The disparity map (right) shows the per-pixel shift — bright = close, dark = far.

VIZ_06 :: STEREO_DISPARITY—
LEFT CAMERA
RIGHT CAMERA
DISPARITY (depth)
Object distance Z 3.0 m
Baseline B 0.10 m
Focal f (px) 300
disparity (px)— depth (formula)— precision @ z—

Why baseline matters

A wider baseline (cameras spread further apart) gives you more disparity per unit depth — better for far objects. But it also shrinks the overlap region between left and right views. Stereo rigs are a compromise:

Active stereo (Intel RealSense, Microsoft Kinect) projects an IR speckle pattern so even blank walls become matchable. ToF (time-of-flight) skips the matching problem entirely by measuring how long the light takes to come back — but it's noisier and lower resolution.

Sources & further reading

← Projection 05 / 07 Next: DINOv3 →