Stereo vision

On this page 7

Stereo vision is the technique of recovering three-dimensional depth from two images taken by cameras a known distance apart. By finding the same point in both images and measuring how far it shifts between them, a system computes how far away that point is. In robot perception, stereo vision is one of the main ways to build dense depth maps and point clouds without active illumination.

The principle mirrors human binocular vision: the two eyes see slightly different views, and the brain fuses them into depth. A stereo camera rig does the same with geometry and computation, producing depth for every matched pixel at camera frame rates.

How disparity becomes depth

The core relation of stereo vision is simple. For a rectified camera pair, depth Z equals focal length times baseline divided by disparity, written Z = f·B/d. The baseline B is the distance between the camera centers, the focal length f is expressed in pixels, and the disparity d is the horizontal pixel shift of a point between the left and right images.

Because disparity sits in the denominator, depth error grows with the square of distance. A one-pixel matching error barely matters at one meter but becomes large at twenty meters. This quadratic error growth is the defining limitation of stereo vision and drives most design choices.

StepPurposeTypical method
CalibrationFind intrinsics, distortion and relative poseCheckerboard or ChArUco target
RectificationAlign epipolar lines with image rowsWarp both images using calibration
MatchingFind corresponding pixelsBlock matching, SGM or neural networks
Disparity refinementRemove outliers and fill gapsLeft-right check, subpixel interpolation
TriangulationConvert disparity to 3D pointsZ = f·B/d per pixel
Steps of a stereo vision pipeline

Rectification is what makes matching practical. It reprojects the images so that corresponding points lie on the same image row, reducing a two-dimensional search to a one-dimensional search along that row.

Design parameters of a stereo rig

Stereo performance is set mainly by baseline, focal length, resolution and matching quality. Each parameter trades range against other properties, so a rig designed for a tabletop arm differs from one designed for an outdoor vehicle.

ParameterTypical rangeEffect of increasing it
BaselineAbout 5-30 cm on robotsBetter far accuracy, larger minimum range
Focal lengthWide to normal lensesBetter accuracy, narrower field of view
ResolutionAbout 0.3-5 megapixelsFiner disparity, more computation
Disparity search rangeAbout 64-256 pixelsCloser minimum range, slower matching
Subpixel accuracyAbout 0.1-0.25 pixelLower depth noise at long range
Stereo design parameters and their effects

A wider baseline improves accuracy at distance but enlarges the blind zone near the cameras and increases occlusion, where a point is visible to only one camera. Many robots therefore use a baseline of roughly 6 to 12 cm for manipulation and wider rigs for driving.

Stereo matching algorithms

The hardest part of stereo vision is the correspondence problem: deciding which pixel in the right image matches a pixel in the left image. Algorithms differ in how much context they use to resolve ambiguity.

  • Block matching compares small windows with a cost such as the sum of absolute differences; it is fast but noisy on weak texture.
  • Semi-global matching (SGM) adds smoothness costs along several image directions and offers a strong balance of speed and quality, often on FPGAs or GPUs.
  • Deep stereo networks learn matching costs and regularization from data and usually give the best accuracy on difficult surfaces, at higher compute cost.
  • Active stereo projects an infrared dot pattern to add texture, which helps on blank walls and tabletops indoors.

Textureless and repetitive surfaces defeat passive matching because many candidate pixels look alike. White walls, glossy floors and fences are classic failure cases, which is why active stereo and learned methods have spread.

Stereo vision compared with other depth sensing

Stereo vision competes with time-of-flight cameras, structured light and LiDAR. Each method fits different ranges, lighting conditions and budgets.

MethodStrengthsWeaknesses
Passive stereoWorks in sunlight, cheap, dense outputFails on textureless surfaces
Active stereoHandles blank surfaces indoorsProjector washed out by strong sun
Time-of-flight cameraDirect depth, little computationMultipath errors, limited sunlight range
Structured lightHigh accuracy at short rangeSensitive to ambient light
LiDARAccurate long range, independent of textureSparse points, higher cost
Depth sensing methods compared

Stereo also differs from monocular depth estimation, which predicts depth from a single image using learned priors. Monocular methods give plausible relative depth but lack the metric geometry that a calibrated baseline provides, so stereo remains preferable when absolute distances matter.

Common errors and how to avoid them

Most poor stereo results come from calibration, synchronization and scene conditions, not from the matching algorithm itself. The following table lists frequent symptoms.

SymptomLikely causeFix
Depth warps or tiltsCalibration drift after shocks or heatRigid mount and periodic recalibration
Ghost edges on moving objectsUnsynchronized camera exposuresHardware-triggered global shutter cameras
Holes on walls and floorsMissing textureActive pattern or learned matching
Noisy far depthShort baseline or low resolutionWider baseline or longer lens
Errors near object bordersOcclusion between viewsLeft-right consistency check
Stereo vision symptoms and fixes

A plain-language summary

Stereo vision lets a machine judge distance with two cameras, the way people use two eyes. Hold a finger in front of your face and close one eye, then the other: the finger seems to jump sideways. Close things jump far, while distant things barely move.

A stereo camera measures that jump for every point it can match in both pictures. A big jump means close, a small jump means far. With a little geometry, the robot turns those jumps into a full three-dimensional picture of its surroundings.

An example from practice

An agricultural robot picks strawberries in a polytunnel. It needs millimeter-level depth within about one meter to guide its gripper, works partly in sunlight that washes out infrared projectors, and must keep hardware costs low.

The team mounts a global shutter stereo camera with an 8 cm baseline on the robot arm and runs a learned stereo network on an embedded GPU. At 40 cm, a disparity error of a quarter pixel corresponds to only about a millimeter of depth error, which is enough to position the cutter at the stem.

The system detects berries in the left image, looks up their 3D positions in the depth map and plans approach paths around leaves. Because the camera is passive, performance stays stable in direct sun, which is where the earlier time-of-flight prototype struggled.