In plain words
A photo is flat. It records colour, but not how far away anything was. Yet you can look at a picture of a street and say at once that the auto is close and the temple is far.
You do it with clues: near things look bigger, far things sit higher and hazier, closer objects block the ones behind them. A depth estimation model learns the same clues from millions of pictures. Give it one photo and it returns a depth map: a grey picture where every pixel says near or far.
Your phone uses this to blur the background in portrait mode. Augmented reality apps use it to put a virtual sofa behind your real table. Robots and cars use it to judge distance, and image generators can use a depth map to keep a scene's layout (see ControlNet).
Everyday example
Judging distance with one eye shut
Close one eye and look across a crowded railway platform. You lose true 3D vision, but you still know the chaiwala is nearer than the train: he looks bigger, he blocks part of the carriage, the far end looks small and faint. A depth model reads exactly these kinds of clues from a single photo, pixel by pixel.
Where the example breaks: You know how big a chaiwala really is, so you can guess metres. A model with one photo often only knows what is nearer than what. A toy car up close and a real car far away can look identical, so it may get the order right but the distance wrong.
How it actually works
Estimating depth from one image is called monocular depth estimation. Strictly, one photo fits many possible 3D scenes, so the model learns which one is most likely.
Learn from photos with known depth
Training images come with depth from depth cameras, laser scanners (LiDAR) or the paired left and right views of 3D films. A 2014 paper from New York University trained a deep network on indoor rooms and street scenes, first guessing the rough layout of the whole image, then refining the details.
Relative depth versus metres
Many models predict relative depth: the order and proportions of distances, without knowing the true scale. Others are fine-tuned to give metric depth in metres, usually for one kind of scene, such as indoor rooms or driving.
Mix many sources to work anywhere
In 2019, researchers trained on five different depth datasets at once, including frames from 3D films, using a loss that ignores scale. The model worked on kinds of photos it had never seen, which earlier models struggled with.
Scale up with unlabelled photos
Depth Anything (2024) trained a teacher model on 1.5 million labelled images, let it label about 62 million ordinary photos with estimated depth, then trained a student on all of them. This self-training made depth models far more general.
Use more than one view when you can
Two cameras, or one moving camera, give real geometric clues, like our two eyes do. Phones combine these with learned depth. Google's Pixel 3 used a neural network on its dual-pixel sensor to predict depth for portrait blur.
- Early deep-learning method
- June 2014, David Eigen, Christian Puhrsch and Rob Fergus at New York University
- Popular open models
- Depth Anything V2 (June 2024, from HKU and TikTok), sizes from about 25 million to 1.3 billion parameters
- Output
- A depth map: one distance value per pixel, usually shown as a grey or colour gradient from near to far
- Where you meet it
- Portrait mode blur, augmented reality, robots, driver assistance, 3D photo effects, depth-guided image generation
Depth estimation is one of the building blocks behind turning photos into 3D, alongside 3D generation.
Questions people ask
How does portrait mode know what to blur?
The phone estimates how far each pixel is from the camera, often with a neural network, and usually also finds the person's outline. Things far behind the subject get blurred more, imitating a big camera lens.
Can AI really get depth from a single photo?
It can make a good guess, not a measurement. It uses the same clues people use with one eye shut: size, overlap, haze, perspective. It is usually good at what is in front of what, and less reliable at exact distances.
What is a depth map?
A depth map is an image where each pixel stores distance instead of colour. Shown as greyscale, near things are often bright and far things dark, or the other way round, depending on the tool.
Is depth estimation the same as LiDAR?
No. LiDAR measures distance with laser pulses, so its numbers are real measurements. Depth estimation predicts distance from ordinary camera images. LiDAR readings are often used as the correct answers when training or testing depth models.
Was this clear?
1 is confusing, 5 is crystal clear. One tap, no account needed.
Spotted something wrong, or know a better example? Suggest a change
Further reading
- Depth Map Prediction from a Single Image using a Multi-Scale Deep Network (Eigen, Puhrsch, Fergus)arXiv, 2014
- Towards Robust Monocular Depth Estimation: Mixing Datasets for Zero-shot Cross-dataset Transfer (Ranftl et al.)arXiv, 2019
- Depth Anything: Unleashing the Power of Large-Scale Unlabeled Data (Yang et al.)arXiv, 2024
- Learning to Predict Depth on the Pixel 3 PhonesGoogle Research, 2018