Skip to content
AI360Xpert
Beta

Stereo Depth from Calibrated Pairs

Two lenses a hand apart see the world twice. Stereo depth turns their pixel shift into metric distance with one division.

Two rectified views triangulate each match into metric depth by baseline over disparity
Two rectified views triangulate each match into metric depth by baseline over disparity

Why Does This Exist?

Monocular depth estimation guesses scale; robots need it measured. Stereo depth exists as the metric answer from passive cameras: with known baseline and intrinsics from camera calibration and parameters, every disparity becomes meters without learning. Learned cost volumes now sharpen the matching, but the geometry stays fixed.

Matching detail is disparity estimation; the two-view tour is stereo vision.

Think of It Like This

Ranging with outstretched arms

Hold a finger up and blink left-right: near fingers jump far, distant doors barely move. Pace your eyes wider apart and even the door starts to jump.

Eyes are cameras and eye spacing is the baseline. The analogy stops at pixels: eyes interpolate smoothly while sensors quantize, so far depth arrives in coarse steps.

How It Actually Works

Rectification warps both images so matches share rows. A cost volume scores disparities dd per pixel, classically by patch cost and now by 3D-convolution over learned features as in PSMNet. Subpixel refinement fits a parabola around the cost minimum. Depth follows Z=fB/dZ = f B / d; range resolution follows ΔZ=Z2Δd/(fB)\Delta Z = Z^2 \Delta d / (f B), so doubling the baseline halves far error but shrinks overlap and raises occlusion.

Worked numbers

Driving rig with f=720f = 720 px and B=0.54B = 0.54 m observes d=129.6d = 129.6 px. Then Z=720×0.54/129.6=388.8/129.6=3.0Z = 720 \times 0.54 / 129.6 = 388.8 / 129.6 = 3.0 m. A 0.250.25 px subpixel error moves depth by 3.02×0.25/388.8≈0.00583.0^2 \times 0.25 / 388.8 \approx 0.0058 m near, while at d=12.96d = 12.96 px (3030 m) the same error moves depth by about 0.580.58 m.

Code

def stereo_depth(d: float, f: float, baseline: float) -> float:    return f * baseline / d  # rectified metric depth

print(stereo_depth(129.6, 720.0, 0.54))  # -> 3.0

Watch Out For

Trusting far stereo past its baseline

Beyond about 5050 baselines the quantization steps exceed object sizes, so cars smear across lanes. The symptom is distant depth that looks dense but wanders meters per frame. Fuse long-range radar or monocular priors instead of stretching stereo alone.

The Quick Version

  • Stereo depth rectifies, matches along rows, and divides fBf B by disparity.
  • Known baseline makes every depth metric without learned scale.
  • Cost volumes plus subpixel fits give modern accuracy near 0.250.25 px.
  • Error grows with range squared over baseline.
  • ff 720720 and baseline 0.540.54 m map disparity 129.6129.6 to 3.03.0 m.
  • Wide baselines gain range but lose overlap and add occlusion.