Stereo Geometry
Stereo vision recovers depth by observing a scene from two cameras of known relative pose. Two cameras separated by a baseline view the same 3D point ; the point projects to pixels in each image, and the offset between those pixels encodes how far lies from the cameras.
A stereo rig is rectified when the two image planes are coplanar, the optical axes are parallel, and the cameras differ only by a horizontal translation along the shared -axis. In a rectified pair, epipolar lines become horizontal and aligned between the two images, so a pixel in the left image corresponds to some pixel in the right image with the same vertical coordinate. The horizontal offset
is the disparity. With both cameras sharing focal length (in pixels) and baseline , the depth of the scene point is
Depth is inversely proportional to disparity: nearby points shift a lot between the two images; distant points shift very little; points at infinity produce zero disparity.Any real stereo pair can be turned into a rectified pair via rectification — a pair of homographies that warp the two images so epipolar lines align horizontally. Once rectified, finding the pixel correspondence reduces from a 2D search over the image to a 1D search along a scanline, which is what makes dense depth estimation tractable.
Disparity and Baseline Trade-off improves depth resolution (a 1-pixel disparity error produces a smaller depth error when is large), but makes correspondence harder (wider view-angle difference means more occlusions and less similar local image content). Stereo rig design is a compromise between these two effects.
A larger baseline
Intuition
Hold a finger in front of your face and close one eye at a time. The finger jumps horizontally against the background — the jump is disparity, and its size tells you how close the finger is. The brain fuses the two views into a single depth estimate; a stereo rig does the same thing with calibrated cameras and explicit geometry.
The geometry that turns disparity into metric depth is a similar-triangles argument in the rectified setup: the ray from each camera to the scene point forms a triangle with the baseline, and the two triangles share the scene point’s depth as an altitude. Solving for gives . The formula fails when (point at infinity — no disparity, no depth constraint) and becomes unreliable when is small (large depth uncertainty per pixel of disparity error).
Rectification reduces the correspondence problem to scanline matching. Without rectification, to match a pixel in the left image the matcher would have to search along an arbitrary epipolar line — diagonal, off-image, or even a pencil of lines through an epipole. With rectification, every match lives on a horizontal row in the right image, which is why every dense stereo algorithm begins with a rectification step.
Properties
Disparity and Depth
(Depth-disparity law) In a rectified pair with baseline and focal length , depth is .
The formula follows from similar triangles. A point at camera-frame position projects to in the left image and in the right image, so . Inverting gives the depth formula. The formula requires identical intrinsics (or post-rectification intrinsics matched between the two cameras) and pure horizontal translation between the two views.
(Inverse relationship) Depth is inversely proportional to disparity; near points have large disparity, far points have small disparity.
A point at depth m with px and m has disparity px. A point at m has px. The nonlinearity means disparity resolution is coarse at long range and fine at short range — a consumer stereo camera can tell m from m easily but cannot tell m from m at all.
(Depth uncertainty) A disparity error produces a depth error .
Differentiating with respect to gives . A sub-pixel disparity error of px at m with px and m yields m — one reason stereo depth is often fused with other modalities at long range.
Rectification
(Rectifying homographies) Rectification applies homographies to the two images so that epipolar lines become horizontal and vertically aligned.
Given the relative pose between the cameras, one constructs a new virtual camera frame whose -axis is parallel to and whose image planes are coplanar. The homographies and warp the original images into this common frame. After rectification the fundamental matrix reduces to with epipoles at infinity along the -axis, so all epipolar lines are horizontal.
(Loss of field of view) Rectification typically discards image regions near the borders.
Because rectification reprojects the images onto a new plane, portions of the original sensor map outside the rectified frame and must be cropped or masked. Wide-baseline or strongly-converging rigs can lose more than half the pixels to rectification. Practical implementations pick the rectification rotation to maximize the overlap region.
Stereo Matching
(Block matching) The workhorse correspondence algorithm scores image patches at every disparity along the scanline and picks the best match.
For each pixel in the left image, a patch around it is compared to patches at candidate disparities along the same row of the right image. The match score is typically sum-of-absolute-differences (SAD), sum-of-squared-differences (SSD), or normalized cross-correlation (NCC). The disparity minimizing (or maximizing, for NCC) the score becomes the pixel’s depth estimate. Patch size trades detail against robustness: patches preserve edges but are noise-sensitive; patches are smooth but blur depth discontinuities.
(Disparity range) Restricting the search to speeds matching and rules out impossible geometry.
Given known minimum and maximum scene depth, one computes the corresponding disparity range and only searches that interval. For a rig with px, m, scene depths in m give px — a narrow band that is much cheaper to search than the full image width.
(Ambiguity and occlusion) Textureless regions produce ambiguous matches, and points visible only in one view have no valid disparity.
A blank wall gives the matcher no signal to lock onto, so block matching returns noise. Points occluded in one camera (behind another object from that viewpoint) have no correspondence and any disparity reported for them is wrong. A left-right consistency check — compute disparity from left to right, and again from right to left, and discard pixels where the two disagree — filters many of these cases.
(Global methods) Graph-cut, semi-global matching (SGM), and belief propagation add smoothness priors that tie neighboring disparities together.
Pure block matching decides each pixel independently and produces noisy, fragmented depth maps. Global methods minimize an energy where the smoothness term penalizes disparity jumps between neighbors except across image edges. SGM approximates the 2D optimization with several 1D dynamic-programming passes and is the de-facto standard on embedded stereo rigs. Learned methods (PSMNet, RAFT-Stereo) replace the handcrafted energy with a neural network.
Stereo Rig Design
(Calibration) A stereo rig is calibrated by estimating both intrinsics and the relative pose between the two cameras.
Standard Zhang-style calibration with a shared checkerboard captured in both cameras recovers all parameters jointly by minimizing reprojection error. The output feeds into rectification, which is precomputed once for a fixed rig and applied per-frame as a lookup table.
(Synchronization) The two cameras must capture simultaneously, or moving objects break the rectified-row assumption.
Hardware triggering (a shared shutter signal) is the clean solution; software synchronization (aligning timestamps) works for slow-moving scenes but fails for anything faster than a few pixels per frame interval.
Examples
Depth from Disparity
A rectified stereo rig has focal length px and baseline m. A corresponding pair has left pixel and right pixel . What depth does this imply?
Solution px.
Disparity:
Depth: m.
Disparity Resolution at Range
For the same rig, how well can depth be resolved at m versus m, given a disparity uncertainty of px?
Solution .
At m: m cm.
At m: m.
A 100-fold range increase produces a 100-fold drop in relative depth resolution — the quadratic cost of the inverse-disparity formula.
Baseline Trade-off
Doubling the baseline from m to m on a px rig changes which quantities?
Solution scales linearly with .
Disparity doubles (better resolution):
Depth uncertainty halves at the same disparity error: scales as .
Matching difficulty increases: wider view angle means larger perspective distortion between left and right patches, more occlusions, and more textureless surfaces appearing differently in the two views. The trade-off between geometric resolution and correspondence difficulty is why hand-held stereo (narrow baseline) and aerial stereo (wide baseline) live at different operating points.
See Also
- 5.1. The Pinhole Camera — the single-camera model that stereo generalizes
- 5.3. Epipolar Geometry — the two-view geometry that rectification simplifies
- SfM — uncalibrated multi-view depth recovery
- MVS — dense depth beyond two views, building on rectified stereo primitives