robotics//sensor//camera//stereo vision

Stereo vision is the recovery of depth from two cameras mounted a known distance apart, by measuring how far the same point shifts between their two images, and it gives robots, drones and cars a depth map with no moving parts and no emitted light. A point close to the cameras appears at quite different positions in the left and right images; a distant point appears almost at the same place. That shift in pixels is the **disparity** \(d\), and with the focal length \(f\) in pixels and the distance between the cameras \(B\) (the baseline), the depth is


Stereo vision is the recovery of depth from two cameras mounted a known distance apart, by measuring how far the same point shifts between their two images, and it gives robots, drones and cars a depth map with no moving parts and no emitted light. A point close to the cameras appears at quite different positions in the left and right images; a distant point appears almost at the same place. That shift in pixels is the disparity ddd, and with the focal length fff in pixels and the distance between the cameras BBB (the baseline), the depth is

Z=f Bd,δZ≈Z2f B δd.Z=\frac{f\,B}{d},\qquad \delta Z \approx \frac{Z^2}{f\,B}\,\delta d .Z=dfB​,δZ≈fBZ2​δd.

The second expression is the one that decides where stereo is useful: an error of a fraction of a pixel in the disparity becomes a depth error that grows with the square of the distance. With f=700f=700f=700 px, B=0.12B=0.12B=0.12 m and a matching error of a quarter pixel (illustrative figures of the right order), the depth is good to about 7 cm at 5 m and only to about 1.2 m at 20 m.

The baseline is the design knob. A wider one improves depth at range and makes close objects harder to match, and it has to fit the vehicle: a small drone carries a few centimetres, a car can carry tens.

Matching needs texture. A white wall, a uniform floor or repeated patterns (a fence, a tiled facade) give the matcher nothing or too many candidates, and the depth map fills with holes or false surfaces. The two cameras must also expose at the same instant and stay calibrated to a fraction of a pixel; a small shock that shifts one camera biases every depth (sensor calibration).

It is the passive alternative to a lidar: cheaper, lighter, with colour and texture for free, and competitive at a few metres, which is why small drones avoid obstacles with stereo pairs. At tens of metres, and in the dark, the lidar wins (camera, perception).