Skip to content

© 2026 Rami Kronbi · Beirut, Lebanon

Back
Writing

Measuring road speed with one camera, and knowing how wrong it is

A camera on a pole is the cheapest speed survey a street can get. The hard part is not measuring speed; it is knowing how far to trust the number.

The project: Road-speed audit from one fixed camera →
A rendered street scene labelled “Simulated scene”, with tracked vehicles showing measured and true speeds.
A frame from the simulator, with measured and true speeds. Simulated, not a real road.

Speed is one of the main risk factors on roads: the World Health Organization estimates that every 1 % increase in mean speed raises the risk of a fatal crash by about 4 %. A municipality that wants to calm a street, argue for a crossing or check whether a measure worked needs speed data for that particular street. Radar surveys cost money and staff time. A camera on a lamp post is cheap, but its numbers are only useful if their error is known, and only acceptable if it does not become a surveillance device.

From pixels to metres

The method is classical computer vision. A handful of points on the road, measured with a tape and clicked on one frame, give a homography: a mapping from the image to metres on the road plane. Background subtraction finds moving vehicles, a Kalman tracker follows each one through the frames, and the point where the tyres meet the road is mapped onto the road. A robust straight-line fit of position against time, inside a defined measurement zone, gives the speed.

Each record leaves with an uncertainty, computed by perturbing the calibration and the pixel positions and fitting again. Records that look doubtful, such as merged vehicles, gaps or large residuals, go to a human review queue instead of into the statistics. The tool writes numbers, not images.

Ground truth from a simulator

The difficulty with validating speed measurement is ground truth: on a real road, the true speed of every car is exactly what nobody has. So the project includes a renderer that draws road scenes through a calibrated camera, with lane markings, buildings, shadows, sensor noise, compression and motion blur, and knows every vehicle’s true speed. The full pipeline runs on those frames exactly as it would on a video file.

On the baseline setup, a camera on a 6 m pole watching a zone 20 to 50 m away at 30 frames per second, 95 % of measured speeds were within about 1 km/h of the truth, with no false records. Over 20 simulated traffic runs, the 85th-percentile speed that planners use came out within about 1.2 km/h (RMSE).

Where it breaks

The useful part of 221 simulated runs is the map of failures. Distance matters most: each pixel covers more road further away, so at 75 m the 95th-percentile error reaches 7.6 km/h and fewer than half the vehicles are measured. The point that is tracked matters almost as much. Tracking the centre of the vehicle’s box, without correcting for its height, gave 95th-percentile errors of 17 km/h; the bottom edge, located to a fraction of a pixel, gave about 1 km/h. Sensor noise, compression and motion blur barely mattered. Dusk and flat lighting without cast shadows did, and there the stated uncertainty was too small, which is the more dangerous failure.

A few passes of a car driven at a known speed correct most of the calibration error. In one simulated low-resolution, far-zone setup, five such passes cut the speed bias from about 6 % to under 2 %.

What simulation cannot say

The simulated road is flat and straight, the lens is ideal and the vehicles are boxes. These numbers describe the method when its assumptions hold. The next step is a field check against radar or GPS on one real road, following a protocol written for it. Until then the tool is an audit aid for planning, and it is not, and should not become, an enforcement device.

Links