Computer vision
Depth, Stereo, and Projective Geometry
Understand disparity, triangulation, monocular priors, depth sensors, scale ambiguity, and evaluation for spatial vision.
By the end you can
- Relate stereo disparity and camera baseline to triangulated depth
- Distinguish metric, relative, inverse, and ordinal depth outputs
- Explain monocular scale ambiguity and learned depth priors
- Evaluate depth systems across range, edges, invalid pixels, and downstream geometry
Visual
Four routes to depth evidence
Depth can be measured or inferred through different physical and statistical mechanisms.
The four routes differ above all in how much of an image they actually measure. KITTI's 64-layer, 10 Hz laser scanner, projected into the image, covers approximately 5% of it. A monocular network returns a number for every pixel of the same frame. Both outputs are called depth maps. Only one of them is mostly measurement.
Stereo or multi-view geometry
Corresponding pixels and calibrated viewpoints support triangulation.
Active depth sensing
Structured light, time of flight, or lidar measures scene range.
Motion parallax
Camera movement provides changing viewpoints over time.
Monocular learning
A model predicts depth from perspective, appearance, and learned scene priors.
Stereo depth begins with correspondence
For rectified stereo cameras, the same scene point appears at different horizontal positions; greater disparity generally indicates smaller depth when focal length and baseline are fixed.
Correspondence is difficult in textureless areas, reflections, repeated patterns, occlusions, and lighting differences. Calibration error is not a caveat to append. It is a measured bias with a measured cost.
The Middlebury 2014 stereo release is 33 six-megapixel datasets built to 0.2-pixel disparity accuracy. Building them, Scharstein and his co-authors found that standard OpenCV rectification did not leave the pairs aligned to anything like that tolerance. “At a resolution of 6 MP residual vertical disparities of several pixels are common, especially in image corners.”
Their bundle-adjustment refinement cut the average absolute y-error from 0.77 to 0.096 pixels, a factor of 8.1, and the maximum from 2.76 to 0.67, a factor of 4.1. Then they priced the difference. Re-running matching on the “imperfect” rather than the “perfect” rectification raised disparity error by 9% on the 18 datasets whose average absolute y-disparity was under 0.5 px. On the three whose y-disparity fell between 1.5 and 3.0 px, it raised the error by 154%.
Žbontar and LeCun report the same defect from the other side: vertical disparity errors of up to nine pixels from standard OpenCV rectification on Middlebury. They survive it by deliberately injecting a small vertical offset during training. A matcher tuned on a well-rectified pair is being asked, in the field, to search a line that is not where it was told.
Triangulation is only as reliable as the correspondence and camera model it receives: on the three worst-rectified Middlebury 2014 pairs, imperfect rectification cost 154% more disparity error.
Case
KITTI's stereo tolerance had to bend with distance
The disparity-to-depth relation is simple to state and easy to over-trust. Scharstein and Szeliski recorded the habit in 2002: “In computer vision, disparity is often treated as synonymous with inverse depth”. OpenCV's own reference documentation states the rectified-pair relation as disparity = x - x' = Bf/Z, and concludes that “the depth of a point in a scene is inversely proportional to the difference in distance of corresponding image points and their camera centers”. Halve the depth, double the disparity.
The KITTI 2015 stereo benchmark shows what that curvature does to a tolerance. The set “consists of 200 training scenes and 200 test scenes (4 color images per scene, saved in loss less png format)”, the benchmark page says, and the same page fixes the accuracy rule: “we consider a pixel to be correctly estimated if the disparity or flow end-point error is <3px or <5%”. Menze and Geiger, whose 2015 paper stands behind the benchmark, state the outlier side of the same rule: “We only count errors if the disparity or flow exceeds 3 pixels and 5% of its true value.”
A pixel is wrong only when it fails both tests at once. A threshold in pixels alone would have been unfair at range, where a single pixel buys many metres. A threshold in percent alone would have been unfair up close, where three pixels of error may be a few centimetres. The tolerance had to bend because the quantity does.
Comparison
Metric, relative, ordinal, and inverse depth
Depth outputs can look similar while supporting different product claims.
The metric row's requirement — scale information supplied from somewhere outside the image — is exactly the requirement Apple's Depth Pro was built to remove. It is worth seeing what a current system actually claims rather than leaving the requirement abstract. Apple published Depth Pro at ICLR 2025, with code and weights released, and the abstract does not hedge: “The predictions are metric, with absolute scale, without relying on the availability of metadata such as camera intrinsics.” The model produces a 2.25-megapixel depth map in 0.3 seconds on a standard GPU, and estimates focal length from the single image itself.
Read carefully, that moves where the scale comes from without abolishing the question. The metres are now inferred by the model from the image, rather than handed to it by a calibration file. That is a different provenance for the same number. Provenance is what the four rows above are really distinguishing.
Metric depth
Estimates distance in physical units.
- Needs scale information
- Supports measured clearance
- Sensitive to calibration
- Example: robot obstacle range
Relative depth
Captures proportional or scene-specific depth structure.
- Scale may be arbitrary
- Useful for composition and ordering
- Cannot certify metres
- Example: photo editing
Ordinal depth
Predicts which point is nearer or farther.
- Lowest scale commitment
- Useful for layering
- Cannot measure distance gaps
- Example: occlusion reasoning
Inverse depth or disparity
Represents nearby structure with larger numeric variation.
- Natural for stereo
- Emphasizes close range
- Requires careful conversion
- Can stabilize some optimization
Example
Where depth estimators commonly break
These conditions challenge physical sensors and learned predictors in different ways, and each one breaks a specific assumption rather than merely adding noise.
- Reflective glass: Stereo correspondence and active infrared can return invalid or misleading range, which is one reason a laser's returns cover so little of a scene.
- Textureless wall: Many pixels look alike, so local matching lacks a unique correspondence and the smoothness prior, not the evidence, decides the value.
- Thin railing: Downsampling and smoothness priors erase narrow foreground structure that a per-pixel average error will never notice is missing.
- Novel scale: A monocular model applies familiar object-size priors to an unfamiliar scene — and its published score was probably computed after the ground truth supplied the scale it is now guessing.
- Moving object: Multi-view geometry assumes a relationship that independent object motion violates, so the triangulated rays intersect at a point that was never occupied.
- Depth edge: Interpolation mixes foreground and background distances along object boundaries, producing distances at which nothing exists.
Analogy
Estimating distance with two separated observers
Two observers stand apart and measure the angle to the same landmark. Their separation and angular difference allow triangulation.
Both observers know which landmark they sighted. That footing is gone when image matching is ambiguous, or when the scene point moves between observations. The separation matters twice over: it is what makes the angles differ at all, and it is the one length in the whole arrangement that is known in metres. Baseline, calibration, and correspondence determine stereo depth. A metric answer can only be as good as the measured baseline it is scaled by.
Stereo does not measure depth directly; it infers depth from matched rays, and gets its metres from the one distance somebody measured with a ruler.
Key idea
Monocular metric depth is a learned conditional estimate
A single image generally permits multiple three-dimensional scenes related by scale and projective ambiguity; a model can produce metric-looking depth by learning camera and scene regularities from data.
The field settled its own accounting for this more than a decade ago, and the accounting is visible in how the numbers are reported. The scale-invariant error for single-image depth arrived in 2014, from Eigen and his co-authors, precisely because the task is ambiguous in overall scale: it scores a prediction under the alignment that best matches it to the ground truth.
Five years later, Monodepth2 spelled out the operational consequence. Godard and his co-authors score their monocular models after per-image median ground-truth scaling. Their stereo-supervised models they do not. “For results that use any stereo supervision we do not perform median scaling as scale can be inferred from the known camera baseline during training.”
That estimate may be useful. Yet it must be validated under target cameras, object scales, and environments. A published monocular score is not that validation, because the score may already have been given, per image, the one quantity the deployed system will have to produce on its own. Familiar appearance is not an independent scale measurement.
A monocular benchmark number can be a measure of shape alone, with the scale quietly supplied at scoring time by the ground truth.
Case
MiDaS bought cross-dataset generality by giving up scale
Monocular systems earn their scale from the training data, and the honest ones say so in the abstract. MiDaS was trained on a deliberately incompatible mixture. Ranftl and his co-authors “experiment with five diverse training datasets, including a new, massive data source: 3D films”, whose annotations do not agree with one another. They buy that mixture by discarding the very quantity a product wants: they “propose a robust training objective that is invariant to changes in depth range and scale”. They then tested by “zero-shot cross-dataset transfer, i.e. we evaluate on datasets that were not seen during training”.
The model's name is not in the paper's prose at all. It survives as a release address in the closing line of the conclusion: “Our models are freely available at https://github.com/intel-isl/MiDaS.”
The benchmarks that judge such work stay small. NYU Depth V2, the usual indoor one, provides “1449 densely labeled pairs of aligned RGB and depth images”, drawn from 464 indoor scenes and recorded with a Microsoft Kinect. A model that generalises across five heterogeneous sources is being certified against fourteen hundred labelled frames from one sensor in one kind of room.
Steps
Evaluate depth as geometry, not only as a heatmap
Use error measures and tasks that expose range and boundary behavior.
Step 2 is not a counsel of thoroughness. Error genuinely has a shape in distance, and two independent teams measured that shape on the same sensor. Khoshelham and Oude Elberink put the Kinect result in their abstract: “The random error of depth measurement increases with increasing distance to the sensor, and ranges from a few millimeters up to about 4 cm at the maximum range of the sensor.” That maximum range is 5 m. Their conclusions turn the curve into an operating limit: for indoor mapping applications, the data should be acquired within 1–3 m of the sensor.
A second team fitted the same behaviour to an equation. Measuring lateral and axial noise on a rotating planar target at z-distances of 0.5–2.75 m across a range of surface angles, Nguyen and his co-authors gave the axial component as σz(z,θ) = 0.0012 + 0.0019(z − 0.4)² metres for 10°≤θ≤60°. That is quadratic in distance. Lateral noise grew only linearly.
A single aggregate error figure averages the near range, where this sensor is good to millimetres, with the far range, where it is out by centimetres. It reports a number that describes neither.
1. Define valid pixels
Specify sensor holes, occlusions, sky, reflective surfaces, and range limits.
2. Measure errors by distance
Separate near, medium, far, and critical operating ranges.
3. Inspect relative and metric behavior
Use scale-aligned metrics only when the product claim allows alignment.
4. Evaluate edges and thin objects
Check foreground fattening, bleeding, and missing narrow structures.
5. Test downstream geometry
Measure collision margins, reconstruction, pose, or planning outcomes.
Depth sensors have missingness patterns, not only noise
Active sensors may fail on sunlight, dark surfaces, reflective materials, or ranges outside specification; stereo fails differently, while monocular predictions can fill holes using learned priors.
The proportions involved are not close. A 93k-frame semi-dense depth dataset derived from KITTI raw came with a measurement of what the 64-layer, 10 Hz laser actually delivers to an image: “If projected to the image, the depth measurements cover approximately 5 % of the image.” Uhrig and his co-authors then priced the alternatives against each other. Raw LiDaR: density 4.0%, at a 1.62% KITTI outlier rate. Their cleaned annotation: 16.1% at 0.31%. Semi-global-matching stereo: 82.4% density at 4.52%. Density and correctness trade directly.
Wong and Soatto, evaluating a different method, describe the same KITTI input independently as sparse maps with a density of about 5%, with semi-dense depth existing only for the lower 30% of the image.
Fusion should preserve source validity and disagreement rather than silently replacing every missing measurement, and confidence must be evaluated for each source condition. A pipeline that hands downstream code one dense array has thrown away the distinction between the 4.0% that a laser returned and the remainder that an algorithm proposed. Those two populations have outlier rates that differ by more than a factor of two.
A dense depth map can hide where evidence was measured and where it was inferred: on KITTI, the laser measures about 5 pixels in 100.
Example
Artifacts for a defensible depth deployment
Depth systems need more than colorful qualitative examples, and the condition slices they are asked for are not hypothetical.
The Insurance Institute for Highway Safety first ran its nighttime pedestrian autobrake evaluation on 30 August 2022. 23 vehicles went through it: four rated superior, seven advanced, eight basic and four no credit. The comparison that matters is with the same test in daylight. “Eight of the 12 vehicles that earn a basic rating or no credit in the nighttime test got superior or advanced ratings in the daylight evaluation.”
The Institute's field research points the same way. Pedestrian crash rates were 27% lower for vehicles with pedestrian AEB across all light conditions, and no different at all for crashes at night on roads without streetlights.
A regulator then wrote the slice into a binding test. NHTSA cited the finding that systems performing well in daylight performed poorly in the dark when it adopted FMVSS No. 127 on 9 May 2024: “Importantly, this final rule requires that PAEB systems be able to avoid pedestrian crashes in dark testing conditions”. Compliance is due 1 September 2029, and the rule is estimated to save at least 362 lives and mitigate 24,321 non-fatal injuries a year. A lighting slice omitted from a test plan is a lighting slice somebody else may eventually mandate.
- Camera or sensor calibration, synchronization, units, and valid operating range, with residual rectification error stated in pixels rather than assumed to be zero
- Ground-truth acquisition method and its own uncertainty, including the density of the measurement it actually provides
- Error curves by distance, material, lighting, motion, and image region, reported per slice rather than as one aggregate
- Edge and thin-object evaluation with representative targets
- Source-validity masks and fusion behavior during disagreement, keeping measured and inferred pixels distinguishable downstream
- Downstream safety margins, fallback policy, and recalibration triggers
Key takeaways
- Stereo depth depends on calibrated geometry and reliable correspondence: imperfect rectification raised disparity error by 154% on the three worst Middlebury 2014 pairs, and by 9% even on the eighteen best.
- Metric, relative, ordinal, and inverse depth support different claims. Depth Pro's ICLR 2025 claim of absolute scale with no camera intrinsics moves where the scale comes from rather than removing the need to earn it.
- Single-view metric depth relies on learned priors because absolute scale is generally ambiguous. That is why monocular results on KITTI are conventionally scored only after per-image median ground-truth scaling, and stereo-supervised ones are not.
- Depth error has a shape in distance: Kinect random error runs from a few millimetres near the sensor to about 4 cm at its 5 m maximum range, with axial noise fitted as quadratic in z and lateral noise only linear.
- Sensor fusion should retain validity and source information: KITTI's laser covers approximately 5% of the image, and buying 82.4% density from stereo came with a 4.52% outlier rate against raw LiDaR's 1.62%.
- Downstream tests must be sliced by condition, because passing one does not transfer: eight of the 12 vehicles rated basic or no credit in the IIHS night test had rated superior or advanced in daylight.