Time-of-Flight Sensing
Light crosses a room in nanoseconds; timing it gives distance directly. Time-of-flight sensors strobe invisible light and clock its return, painting per-pixel depth.
Why Does This Exist?
Triangulation needs texture: stereo fails on blank walls, structured light washes out in sun, and both degrade with distance. Yet robots, phones, and cars need dense depth on exactly those blank, bright, far surfaces. Geometry from images alone cannot oblige.
Time-of-flight (ToF) stops inferring depth and measures it: strobe the scene with invisible near-infrared, clock each pixel's return, convert delay to distance. One chip, no baseline, full-frame depth at video rate. The ray-direction sibling is light field imaging; the triangulation sibling is stereo vision.
The one idea you need first. Direct ToF times pulses: (halved for the round trip). Indirect ToF strobes continuously at frequency and reads the returned phase shift : . Direct reaches far with single-photon detectors; indirect is cheap silicon that wraps past its unambiguous range.
Think of It Like This
Shouting in a canyon
Stand at a canyon rim and shout: the echo returns after a delay that is distance made audible — half a second, about eighty-five meters of rock. Nobody triangulates the cliff face or studies its texture; the round trip is the measurement, and fog changes nothing about the arithmetic.
ToF shouts with light billions of times per second per pixel. Each pixel is an ear with a stopwatch; the scene's depth map is canyon walls rendered in echo delays. Multipath (echoes of echoes) confuses it exactly the way canyon echoes confuse shouters — the analogy's failure mode transfers too.
How It Actually Works
Direct systems (LiDAR, phone SPAD arrays) fire picosecond pulses and histogram photon arrivals per pixel; the peak bin is the range. Indirect systems modulate an LED or laser at megahertz rates and sample the return at four phase quadrants, computing from the samples — cheap CMOS, ambiguous past (about m at MHz). Both calibrate for temperature drift, ambient suppression (sunlight is broadband competition), and per-pixel offsets. Fusion with RGB paints color onto measured depth.
Range, resolution, and sunlight form the iron triangle: extending one costs the others.
Worked example
Direct: round trip ns. m. A ns timing error moves the answer m — picosecond electronics earn their keep.
Indirect: modulation MHz, measured phase (quarter cycle). m. Same scene, no stopwatch — the phase fraction carries the distance.
Code
The point of this snippet is the conversion: nanoseconds and phase fractions become meters in two lines each.
import math
C = 3.0e8 # m/s, exact enough for cameras
def direct_tof(dt_s: float) -> float: return C * dt_s / 2.0 # halved: light travels both ways
def indirect_tof(phase_rad: float, freq_hz: float) -> float: return C * phase_rad / (4.0 * math.pi * freq_hz)
print(direct_tof(20e-9)) # -> 3.0print(round(indirect_tof(math.pi / 2, 20e6), 3)) # -> 1.875Watch Out For
Multipath corners that invent distances
Light bouncing wall-to-wall arrives late, and the pixel averages all paths into one phantom range between the surfaces. Corners, mirrors, and translucent objects report distances no surface occupies — confident, dense, wrong.
Treat corner ranges as suspect: multi-frequency unwrapping and multipath-robust sampling reduce the ghosts, but geometry near concavities needs explicit handling. Validate depth at corners, not just open walls.
Sunlight that swamps the strobe
Outdoor ambient infrared dwarfs milliwatt strobes: the return drowns in solar shot noise and range collapses to noise past a few meters. Indoor specs quoted without sunlight mislead every outdoor deployment.
Derate for sun: demand outdoor range curves, add optical bandpass filtering, and prefer direct ToF with high peak power for daylight. A depth camera specced in a dark lab is a different instrument outdoors.
The Quick Version
- ToF measures depth from light travel time: pulses timed directly, or phase shifts read indirectly.
- The worked fixture gives m for a ns round trip and m for a quarter-cycle at MHz.
- No baseline, no texture needed: blank sunlit walls resolve where stereo surrenders.
- Corners multipath into phantom ranges; treat concave geometry as suspect until handled.
- Sunlight swamps weak strobes, so demand outdoor curves and derate lab specs.