Monocular Depth Estimation: Measuring Distance from a Single Photo

Monocular Depth Estimation: Measuring Distance from a Single Photo

E
By Etzal Earth
11 min read

A photograph of a street and a photograph of a scale model of that street can be identical. No amount of processing applied to one image can tell the two apart, because the image is a projection and projection discards exactly the information that would distinguish them. Doubling every distance in a scene and doubling the focal length produces the same pixels.

This is the fundamental ambiguity of single-image depth, and it is not a limitation of current methods that better models will remove. It is a property of the geometry. Understanding it is the difference between using monocular depth well and shipping measurements that are wrong by a constant factor nobody notices.

What single-image methods can do is recover structure: which surfaces are nearer, how the scene is arranged, where the ground plane runs, where the discontinuities are. That is a great deal, and for many purposes it is enough. The trouble starts when structure is presented in metres.

Relative depth, metric depth, and why the distinction is the whole story

Relative depth gives an ordering, and often more than an ordering: a depth map that is correct up to an unknown scale factor, sometimes up to an unknown scale and offset. Everything in the scene is in correct proportion to everything else, but the units are arbitrary.

Metric depth gives distances in real units. A pixel labelled 12.4 means twelve point four metres from the camera.

Many systems that output metric-looking numbers are doing relative estimation with a scale recovered from assumptions, and the assumptions are usually invisible in the output. A depth map full of plausible metre values is not a claim of measurement unless the scale source is stated.

There is a further subtlety in the parameterisation. Many methods work in inverse depth, sometimes called disparity, because it makes near geometry well conditioned and compresses the far field. A model trained and evaluated in inverse depth is being scored mostly on the near part of the scene. Converting its output to depth expands whatever error exists at small inverse-depth values into large distance errors, which is why the far field in monocular depth output is so much worse than the visual quality of the near field suggests.

The affine-invariant case is the one that catches people. If the output is correct only up to scale and offset, then differences between two depths in the map are not proportional to real distance differences until the offset has been resolved. Subtracting two values from such a map and treating the result as a distance is an error even after a scale factor has been applied.

How scale gets recovered

Since the image cannot supply scale, it has to come from outside. There are four practical sources, in roughly ascending order of reliability.

Known object sizes. If something in the frame has a size that can be assumed, the scale follows. Doorways, standard road markings, vehicle dimensions, brick courses, standard signage, rail gauge, shipping containers. This is cheap and requires no equipment, and its weakness is that the assumed sizes are regional and generational. Door heights, lane widths, sign dimensions and vehicle sizes differ between countries and between decades. An assumption imported from one region into another introduces a systematic scale error across every measurement in the image.

Camera height and a ground plane. If the camera height above the ground is known and the ground plane can be located in the image, the scale follows from the geometry. This is the standard approach for vehicle-mounted and body-mounted capture, where the mounting height is fixed and measurable. It fails when the ground is not visible, when the ground is not flat, and when the camera pitches or the vehicle's suspension loads, since a small change in effective height scales everything.

Camera intrinsics. Knowing the focal length and sensor size does not by itself resolve scale, but it removes one unknown and makes the other constraints far stronger. Image metadata sometimes carries a nominal focal length, which is better than nothing and worse than calibration, particularly on phones where digital cropping and stabilisation alter the effective geometry without changing the recorded value.

A calibration target or a second view. Placing an object of known dimension in the scene, or capturing a second image from a known baseline, resolves scale properly. This is the reliable option and it requires either preparation at capture time or a second image, which is often exactly what was unavailable.

The important habit is to record which of these supplied the scale for any given measurement. Two measurements scaled by different mechanisms are not comparable, and a measurement whose scale source is unrecorded cannot be audited later.

Error compounds with distance

Depth error in monocular estimation is not uniform across the image. It grows with distance, and it grows faster than linearly.

The mechanism is the inverse relationship between image position and depth. Near the camera, a large change in depth moves a point substantially in the image, so image evidence constrains depth tightly. Far away, a large change in depth moves a point barely at all, so the same amount of image evidence constrains depth loosely. A fixed uncertainty in the image translates into a small depth uncertainty nearby and a large one far off.

The practical consequence is that a measurement taken between two nearby surfaces is far more trustworthy than one spanning the scene. Measuring the width of a doorway ten metres away is a different proposition from measuring the distance to a building at the end of the street, even though both come from the same depth map with the same apparent per-pixel precision.

Two further effects amplify it. Error in the recovered scale multiplies everything, so a five percent scale error is five percent at every distance and is therefore largest in absolute terms far away. And any offset error in an affine-invariant output behaves worst in the far field, because that is where the true depth values are large and the model has the least evidence to pin them.

The rule of thumb that follows is to prefer measurements that are local in depth, and to treat anything spanning a large depth range as an estimate with a wide band rather than a measurement.

Reflective, transparent and otherwise dishonest surfaces

Depth estimation, learned or geometric, assumes that what is seen at a pixel is a surface at some distance. Several common materials break that assumption outright.

Mirrors and polished glass return the depth of the reflected scene, not the surface. A model may predict the depth of the reflection, producing a hole in the geometry where a wall exists, or it may recognise the frame and interpolate, producing a plausible surface that was never measured. Both happen, and which one occurs is not predictable from the output.

Windows are worse than mirrors because they are partially both. A shopfront window shows reflection of the street, transmission of the interior, and the glass surface itself, at different intensities across the pane and varying with viewing angle and time of day. Depth output across a glazed facade is generally unreliable and generally confident.

Water surfaces combine reflection, transmission and motion. Wet roads after rain acquire the same behaviour temporarily, which means depth quality on the same street varies with the weather.

Uniform, texture-less surfaces provide no evidence at all. A blank white wall filling the frame gives a learned model nothing but context to work from, and the answer comes from the model's prior about what walls at that apparent size usually are, not from the pixels.

Thin structures are systematically lost. Railings, wires, poles, fences and tree branches occupy few pixels and sit against a far background, and the smoothing that makes depth maps look clean drags them toward the background depth or removes them. For any application where thin structures matter, clearance checks, obstruction analysis, this failure is central rather than cosmetic.

Sky must be handled explicitly. It has no depth. Methods that assign it a large finite value create a false surface at the horizon, and anything that averages depth over a region containing sky produces nonsense.

Using depth for measurement, honestly

Measurement from a depth map is legitimate under conditions that can be stated.

The most reliable case is a measurement within a plane roughly parallel to the image sensor, at moderate distance, using a locally recovered scale. Measuring a shopfront width from a photograph taken square on to the facade is close to the best case: the depth across the measured span is nearly constant, so scale error affects both endpoints equally and the geometry is close to a simple rectification problem.

The least reliable case is a measurement along the viewing direction, at range, across a scene containing reflective surfaces. Estimating how far back a building sets from the street in a photograph taken along the street combines every one of the error sources described above.

Between those two, the practical procedure is to decompose the measurement. Identify what part of it lies across the image plane and what part lies along the viewing direction, and recognise that these carry different uncertainties. Report accordingly rather than quoting a single number with an implied uniform precision.

The band should be stated as a band. A facade width from a single photograph with scale recovered from an assumed door height is not five point two metres. It is approximately five metres, with an uncertainty dominated by the door assumption, and if the door assumption is wrong by ten percent then so is the answer. Writing it that way costs nothing and prevents the number being used for something it cannot support.

Self-calibration: check the answer against something known

The most valuable practice in single-image measurement is also the least implemented. If a scene contains any dimension that is independently known, the depth-derived estimate of that dimension is a direct test of the whole chain.

The mechanism is straightforward. Recover scale from one source, then measure a second object whose true size is known from elsewhere, and compare. If the known dimension comes out ten percent short, every measurement in that image is roughly ten percent short, and the correction is applicable across the frame.

Good candidates for the check are things that vary little within a region and can be verified: standard road marking lengths, regulated sign dimensions, kerb heights, standard parking bay sizes, rail gauge, and where a record exists, a building dimension from a cadastral source or a footprint layer. The footprint case is particularly useful for facade work, since a building outline from an authoritative source gives a facade length that can be compared directly against the photographic estimate.

Two caveats keep this honest. The check object must be independent of the object used to recover scale, otherwise the test is circular and will always pass. And the check validates that image, not the method in general, because scale recovery failure is usually image-specific rather than systematic.

Where a check is available and fails, the correct response is to reject the measurement rather than to apply the correction and continue, unless the discrepancy source has been identified. A ten percent disagreement might be a scale error, or it might be that the depth map put a glazed section of the facade in the wrong place, in which case the correction makes some parts of the image worse.

When monocular depth is the right tool

Monocular depth is the right tool when the alternative is nothing. A single existing photograph, an archive image, a frame from an incidental capture: no other method applies, and a structured estimate with an honest band is more useful than a guess.

It is also right for relative questions that never need scale. Which of these two structures is nearer the street. Is there an obstruction between the camera and the far building. What is the rough arrangement of a scene. These use exactly what monocular estimation does well and none of what it does badly.

It is the wrong tool when a decision turns on an absolute dimension and a better source exists. If a footprint layer already records the building outline, its width is known better than any photograph will provide. If the site can be visited, a tape measure settles it. If two images from different positions exist, the geometry becomes properly constrained and the problem stops being monocular.

The failure that reaches production is a depth-derived dimension, generated at scale across thousands of images, published as a field with no method note and no band. It looks like data. Every value in it inherits a scale assumption made once, in code, about a class of object that varies by region. When the assumption is wrong, the entire field is wrong in the same direction, and because the errors are correlated rather than random, no amount of aggregation reveals it.