A single RGB camera records image coordinates and color, not the physical distance from the lens to every visible surface. Monocular depth models infer the missing depth structure from visual evidence learned during training. That distinction matters when using MiDaS or DPT: a convincing depth map does not automatically mean that pixel values are distances in meters.
MiDaS is an open-source project for robust monocular relative depth estimation. DPT, or Dense Prediction Transformer, is an architecture for dense prediction that has also been used as a backbone in MiDaS models. Both make single-camera depth estimation practical, but neither changes the geometric ambiguity inherent in one unconstrained RGB image.
A depth map is not necessarily a distance map
A depth model produces one value for each image location:
RGB image
|
v
depth model
|
v
dense depth predictionFor a metric sensor such as a calibrated stereo rig, time-of-flight camera, or LiDAR, the resulting measurement can be tied to a physical unit through known geometry or signal timing.
Relative monocular estimation solves a different problem. It tries to preserve scene ordering and depth relationships: one surface is closer, another is farther, and boundaries in the prediction should follow scene structure.
A simplified relative map might look like this:
near object -> 0.82
middle object -> 0.46
far background -> 0.18Those numbers can encode useful depth relationships without meaning 0.82 m, 0.46 m, and 0.18 m. Treating raw model output as meters creates a measurement system that has never been calibrated to meters.
The monocular scale ambiguity
The limitation comes from projective geometry, not from insufficient model size.
Imagine photographing a small object close to the camera. A physically larger version of the same object placed farther away can produce a similar projected size. With only one image, the camera does not receive a second geometric observation that uniquely resolves the scale.
Perspective supplies strong cues:
- apparent object size;
- occlusion;
- texture gradients;
- perspective convergence;
- shading;
- familiar object shapes.
A learned model can combine those cues to infer plausible scene structure. But visual plausibility is not the same as a physical range measurement.
This is why a monocular model can generalize well enough to separate foreground from background while still lacking a trustworthy global metric scale.
What MiDaS actually provides
MiDaS was designed for robust monocular relative depth estimation across varied datasets. Its official repository explicitly distinguishes this output from metric depth and points to approaches such as ZoeDepth when metric estimation is required.
The basic inference path is:
single RGB image
|
v
MiDaS
|
v
relative depth mapMiDaS is useful when the application needs scene geometry without requiring an exact physical range for every pixel. Examples include depth-aware image effects, foreground/background reasoning, 3D visualization, and supplying geometric cues to another perception stage.
The important implementation rule is simple: do not attach a unit such as meters to the raw prediction unless an additional process establishes that scale.
Where DPT fits
DPT stands for Dense Prediction Transformer. It uses a vision-transformer backbone and combines representations into full-resolution predictions for dense tasks such as monocular depth estimation and semantic segmentation.
DPT and MiDaS are therefore not two interchangeable names for the same thing:
DPT
-> dense-prediction architecture
MiDaS
-> monocular relative-depth project/model family
-> includes DPT-based model variantsFor example, MiDaS has distributed model variants such as dpt_large_384 and dpt_hybrid_384. Choosing one of these changes the model architecture and its quality/performance trade-off; it does not by itself convert relative depth into metric distance.
Recovering metric scale requires another constraint
If the application needs centimeters or meters, some independent information must anchor the prediction to the physical world.
One option is a known reference distance. Suppose a stable scene contains a reference point whose true distance is known. A calibration procedure can estimate a mapping between model predictions and physical depth. The exact mapping depends on what the model output represents and cannot safely be assumed to be a universal linear multiplier.
Conceptually:
relative prediction + metric reference
|
v
scale calibration
|
v
estimated metric depthThis can work in a constrained installation where camera position, optics, scene class, and reference geometry remain stable. It is much weaker when the camera moves into arbitrary environments.
A second option is to add geometry. With a calibrated stereo pair, disparity is related to depth by:
Z = fB / dwhere:
Zis depth;fis focal length expressed in compatible image units;Bis the physical baseline between cameras;dis disparity.
The known baseline provides a physical scale that a single unconstrained image lacks.
A third option is an active depth sensor such as time-of-flight or LiDAR. These systems measure range through a physical sensing process rather than relying only on learned monocular cues.
Metric depth models are a different design choice
Some neural models are trained specifically to predict metric depth. That can be the correct choice when a project needs approximate physical distance from a single RGB camera.
The distinction still matters. A metric monocular model estimates distance from learned image statistics; it does not turn the camera into an active range sensor. Accuracy can shift with camera intrinsics, scene type, depth range, lighting, and domains that differ from training data.
The MiDaS repository references ZoeDepth as an approach that combines relative-depth features with a metric-depth component. That is a different objective from interpreting raw MiDaS relative predictions as meters.
For safety-critical ranging, collision avoidance, or measurement tasks with strict error bounds, the sensing architecture should be selected from the required error tolerance backward. A visually coherent depth map is not sufficient evidence of metric accuracy.
Camera calibration still matters
Even when a learned model performs the depth inference, camera geometry affects the image it receives. Focal length, field of view, distortion, cropping, and resizing alter the relationship between the physical scene and image coordinates.
Traditional calibration estimates intrinsic parameters such as:
fx, fy focal lengths
cx, cy principal point
k1... lens distortion coefficientsThese parameters are essential for geometry-based stereo reconstruction and useful whenever predicted depth is projected into 3D coordinates.
Given metric depth Z and calibrated pinhole intrinsics, a pixel (u, v) can be back-projected approximately as:
X = (u - cx) * Z / fx
Y = (v - cy) * Z / fy
Z = ZIf Z is only relative, the resulting 3D reconstruction inherits that unknown scale.
Choosing the sensing method
The right method follows from what the application actually needs.
Use monocular relative depth when the goal is scene structure and a single ordinary RGB camera is a hard constraint. MiDaS is well suited to this class of problem, and DPT-based variants provide several architecture/performance choices.
Use calibrated stereo when metric geometry is important and two cameras can be installed with a known baseline. Stereo has its own failure modes, including low-texture regions, repeated patterns, occlusion, and difficult lighting, but its scale comes from physical camera geometry.
Use time-of-flight or LiDAR when direct range sensing justifies the additional hardware, power, cost, and environmental constraints.
Use a metric monocular model when approximate distance from one RGB camera is required and the expected deployment domain can be characterized and validated. Its error should be measured against ground-truth distances from the actual operating environment.
Open-source implementations
The official MiDaS repository is available at:
https://github.com/isl-org/MiDaSThe original DPT repository is available at:
https://github.com/isl-org/DPTBoth repositories publish source code under the MIT License. The MiDaS repository also contains camera inference support and multiple DPT-based model configurations.
For implementation decisions, distinguish the license of repository code from any separate terms that may apply to external dependencies, datasets, or independently distributed assets.
The engineering boundary
MiDaS and DPT make it possible to recover useful depth structure from a single RGB frame, which is valuable precisely because no dedicated depth hardware is required. Their output should still be interpreted according to the problem they solve.
A relative depth prediction answers questions such as which surfaces are nearer and how scene depth changes across the image. A metric ranging system must additionally establish physical scale. That scale can come from calibrated geometry, a known reference, an active sensor, or a model explicitly trained and validated for metric depth.
Keeping those two outputs separate prevents a common implementation error: turning a plausible AI prediction into a physical measurement simply by assigning a unit to its numbers.