v9.1.1
Menu

Chapter 5: Depth Estimation

Week 5

Master the techniques for recovering depth from images and sensors: monocular depth estimation with deep networks, stereo and multi-view approaches, active sensing technologies like LiDAR and structured light, and the metrics used to evaluate depth quality. Understand the trade-offs between passive and active methods, and learn how to refine sparse depth into dense, accurate maps.

Topics
7
Demos
2
Videos
3
Min read
40

Chapter Overview

Depth estimation is the problem of assigning a distance value to every pixel or point in a scene. It is a cornerstone of 3D computer vision because depth bridges the gap between 2D images and 3D geometry---once you have depth, you can reconstruct surfaces, measure distances, and reason about spatial relationships.

What is this chapter about? We cover the full spectrum of depth estimation methods. We begin with monocular depth estimation, where a single RGB image is used to predict depth using learned cues. We then examine state-of-the-art architectures like MiDaS and DPT that use vision transformers for robust relative depth. Multi-view stereo extends depth estimation to dense reconstruction from many calibrated images. On the hardware side, we explore active sensors---LiDAR, time-of-flight cameras, and structured light systems---that directly measure depth. Finally, we address depth completion (filling in sparse measurements) and the evaluation metrics used to benchmark all these methods.

Why does this matter? Autonomous vehicles need dense, accurate depth maps for obstacle avoidance. AR/VR applications require real-time depth for scene understanding and occlusion handling. Robotics depends on depth for manipulation and navigation. Every downstream 3D task---reconstruction, detection, segmentation---benefits from better depth estimation.

How the topics connect: We start with monocular depth as the most accessible entry point (just one image), then explore MiDaS/DPT as the leading architectures. Multi-view stereo provides denser and more accurate depth when multiple images are available. Active sensors (LiDAR, ToF, structured light) offer direct physical measurements. Depth completion bridges sparse sensor data with dense predictions. We close with evaluation metrics that let you quantitatively compare all these approaches.

Chapter Roadmap

Click any topic to jump in

Explainer videoInteractive demo
1
Monocular Depth

Predicting dense depth from a single RGB image using learned monocular cues and encoder-decoder networks.

The Monocular Depth ProblemEncoder-Decoder Architecture for DepthScale Ambiguity and Self-Supervised Training
From single-image to multi-image depth

Learned architectures and geometric approaches

2
MiDaS & DPT

State-of-the-art architectures that combine mixed-dataset training with Vision Transformers for zero-shot depth.

MiDaS: Mixing Datasets for Robust DepthDPT: Dense Prediction with Vision TransformersRelative vs. Metric Depth and Zero-Shot Transfer
3
Multi-View Stereo

Dense depth from multiple calibrated images using photometric consistency and plane-sweep volumes.

Plane-Sweep VolumesPatchMatchNet and Learned MVSDepth Fusion from Multiple Views
Physical depth measurement

Active sensing — direct measurement without learned inference

4
LiDAR & ToF

Active sensors that directly measure depth using time-of-flight or spinning laser principles.

Time-of-Flight CamerasSpinning and Solid-State LiDARLiDAR Point Cloud Characteristics
5
Structured Light

Projecting coded patterns onto scenes and recovering depth from pattern deformation via triangulation.

Coded Light and Pattern ProjectionTriangulation from Structured LightPractical Systems: Kinect, RealSense, Face ID
Combining and evaluating all methods

Sparse-to-dense refinement and benchmarking

6
Depth Completion

Filling sparse sensor depth into dense maps using guided upsampling and self-supervised refinement.

Sparse-to-Dense Depth CompletionGuided Depth UpsamplingSelf-Supervised Depth Refinement
7
Evaluation Metrics

Quantitative metrics for depth quality — absolute error, threshold accuracy, and scale-invariant measures.

Absolute and Relative Error MetricsDelta Threshold Accuracy (d1, d2, d3)Ordinal and Scale-Invariant Metrics

Topics

7 topics in this chapter

Chapter 4 recovered depth by triangulating the same point seen from several cameras. A phone camera, a dashcam or an old photograph gives you exactly one view, and one view throws away the third dimension: every pixel is the image of an entire ray, and a toy car close up and a real car far away can produce the same picture. Geometry alone cannot undo that. Yet people judge depth from one eye reasonably well, because scenes carry statistical cues: objects resting lower in the frame are usually nearer, texture gets denser with distance, nearer things occlude farther ones, and familiar objects have familiar sizes. Monocular depth estimation trains a network to learn those cues from data and output a depth value for every pixel. This topic sets up the problem: why the answer is only defined up to scale, how encoder-decoder networks produce dense maps, and how self-supervised training on stereo pairs or video replaces expensive ground-truth depth with a photometric reprojection loss. The next topic scales the idea up with MiDaS and DPT, which train on many datasets at once.

Definition

Monocular depth estimation predicts a dense depth map D(u,v)D(u, v) from a single RGB image using learned priors, since one view does not determine depth geometrically. Without a metric reference, the output is defined only up to an unknown scale (and often shift), so models predict either relative depth or metric depth calibrated on known camera and scene statistics.

In this topic

  1. 1The Monocular Depth Problem
  2. 2Encoder-Decoder Architecture for Depth
  3. 3Scale Ambiguity and Self-Supervised Training
1 of 3
The Monocular Depth Problem

Given a single image, monocular depth estimation assigns a depth value to every pixel. The network must learn monocular cues: nearby objects appear larger and lower in the image, texture density increases with distance, edges and occlusion boundaries indicate depth discontinuities, and atmospheric haze reduces contrast at range. The output is either a relative depth map (ordinal relationships only) or a metric depth map (absolute distances in meters). Scale ambiguity is the fundamental challenge---without knowing the physical size of objects in the scene, the absolute scale of depth is unrecoverable from a single image alone.

Mathematical Intuition

Monocular depth is fundamentally ill-posed: the projection π:R3→R2\pi: \mathbb{R}^3 \to \mathbb{R}^2 loses one dimension, so infinitely many depth maps DD satisfy π(D)=I\pi(D) = I for a given image II. The network learns a prior P(D∣I)P(D | I) over plausible depth maps. Scale ambiguity means the likelihood P(I∣D,s)P(I | D, s) is invariant under global scaling D→αDD \to \alpha D — the loss landscape has a degenerate direction that only metric supervision or known reference objects can break.

Example:

A monocular depth model predicts relative depth values ranging from 0.1 to 0.9 for an image. If you know a reference object in the scene is 3 meters away and its predicted depth value is 0.4, how would you convert the entire map to metric depth?

2 of 3
Encoder-Decoder Architecture for Depth

Most monocular depth networks follow an encoder-decoder design. The encoder (often a pretrained ResNet, EfficientNet, or Vision Transformer) extracts multi-scale feature maps from the input image, progressively reducing spatial resolution while increasing channel depth. The decoder upsamples these features back to the original resolution, combining high-level semantic information from deep layers with fine-grained spatial details from skip connections. The final output is a single-channel depth map where each pixel holds a predicted depth value. Loss functions typically combine L1 or L2 pixel-wise depth error with scale-invariant loss and gradient-matching loss to preserve sharp edges.

Mathematical Intuition

The encoder-decoder computes a function f:RH×W×3→RH×Wf: \mathbb{R}^{H \times W \times 3} \to \mathbb{R}^{H \times W} via successive downsampling (each stage halves resolution: H/2k×W/2k×CkH/2^k \times W/2^k \times C_k) and upsampling with skip connections. The receptive field at the bottleneck covers the entire image, giving global context, while skip connections preserve gradients ∇xD\nabla_x D at image edges — without them, the decoder must reconstruct spatial detail from a 1/161/16 resolution bottleneck, causing blurry depth boundaries.

Example:

An encoder produces feature maps at resolutions 1/4, 1/8, 1/16, and 1/32 of the input. The decoder upsamples by 2x at each stage. If the input is 640x480, what is the resolution of the depth map before the final upsampling to full resolution?

3 of 3
Scale Ambiguity and Self-Supervised Training

Scale ambiguity means that a single image cannot determine whether a scene is 1 meter or 100 meters deep---both produce identical images. Supervised methods sidestep this by training on datasets with ground-truth depth from LiDAR or structured light. Self-supervised methods (like Monodepth2) train without ground-truth depth by using stereo image pairs or video sequences. The key insight is photometric consistency: if the predicted depth and camera motion are correct, warping one image to another viewpoint should reproduce the target image. The reprojection error between the warped and actual image serves as the training signal.

Mathematical Intuition

The photometric reprojection loss warps source pixels to the target view: I^t(p)=Is(π(Dt(p)⋅K−1p,R,t))\hat{I}_t(p) = I_s(\pi(D_t(p) \cdot K^{-1}p, R, t)). This involves differentiable bilinear sampling, making the loss a function of DD and pose (R,t)(R, t). The scale ambiguity manifests algebraically: replacing D→αDD \to \alpha D and t→αtt \to \alpha t produces identical reprojection coordinates, so the network can only recover depth up to an unknown scale factor α\alpha.

Example:

A self-supervised depth model predicts depth DD and camera motion (R,t)(R, t) between two video frames. The photometric reprojection loss is L=∣Itarget−warp(Isource,D,R,t)∣L = |I_{\text{target}} - \text{warp}(I_{\text{source}}, D, R, t)|. If the predicted depth is twice the true depth and tt is also scaled by 2x, does the loss change?