Skip to content

© 2026 Rami Kronbi · Beirut, Lebanon

Back
Vision · road safety

Road-speed audit from one fixed camera

Measures how fast cars drive on one street from a single camera, and says how far each number can be trusted.

My partSole author

The tool on a public clip of Germany’s A40 (Kathinka Engels, CC BY 3.0, via Wikimedia Commons; annotations added). The scale comes from standard lane-marking lengths, not a survey, and there is no reference measurement, so these speeds are unvalidated. It gave 8 valid speeds, sent 3 to review and rejected 31 fragments.

In short

An offline, open-source tool that measures vehicle speeds on one road segment from one fixed camera and gives a municipality the numbers it plans with: mean speed, the 85th-percentile speed, the share over the limit and flow, each with an uncertainty. Its accuracy, and where it fails, is measured on simulated video with exact ground truth. It has not been checked against radar on a real road yet. I built it in October 2026.

What it is
A camera, a calibration and a tracker that measure vehicle speeds on one road segment, with an uncertainty on every number, a human review queue for doubtful records, and the statistics a municipality uses.
Why it matters
A municipality that wants to calm a street or check whether a measure worked needs speed data for that street. Radar surveys cost money and staff time; a camera on a pole is cheap, but only useful if its numbers can be trusted and it does not become a surveillance device.
My part
I wrote the pipeline, the simulator that renders road scenes with exact ground truth, and the thirteen experiments that measure where it holds and where it breaks.
A rendered street scene labelled “Simulated scene”: a two-lane road with a green measurement zone, three tracked vehicles with their measured and true speeds, such as 54.8 km/h against a true 54.4.
A frame from the simulator, which knows every vehicle’s true speed. Measured speed beside the truth for each tracked vehicle. Simulated, not a real road.

Step by step

  1. 1

    Calibrate

    Six or more surveyed road points clicked on one frame give an image-to-road homography, with residuals and a recovered camera as a plausibility check.

  2. 2

    Track

    Shadow-aware background subtraction with a sub-pixel bottom edge, a two-stage Kalman and Hungarian tracker, coasting through occlusions, and stitching of partial tracks in road coordinates.

    Bar chart of the 95th-percentile speed error for four choices of tracked point: 1.1 km/h for the sub-pixel bottom edge, 2.6 for the raw blob edge, 3.4 for a height-corrected box centre and 17.4 for the uncorrected box centre.
    Simulated video: tracking where the tyres meet the road, located to a fraction of a pixel, matters most.
  3. 3

    Measure

    A robust fit of position against time inside the zone, quality flags that reject or send records to review, and a Monte-Carlo uncertainty that carries the calibration error into the report.

    Plot of the 95th-percentile speed error against the distance of the measurement zone from the pole, rising from about 0.8 km/h at 25 m to about 11 km/h at 95 m, with the share of vehicles measured at each distance.
    Simulated video: the error grows with distance, and fewer vehicles are measured.
  4. 4

    Validate

    221 simulated runs over 13 experiments: distance, height, tilt, resolution, frame rate, traffic density, calibration error, lighting and weather-like conditions, and the point on the vehicle that is tracked.

    Two panels of position against time: six vehicles approaching at 35–43 km/h and two leaving at 99 and 112 km/h, each a straight line through tracked points.
    The A40 clip: each valid vehicle’s position along the road over time; the slope of its fitted line is its speed.
  5. 5

    Report

    Mean speed, 85th-percentile speed, share over the limit and flow by lane and direction, with 95 % confidence intervals. Numbers only: no images are kept.

Results

1.0 km/h
Speed error
95th-percentile error on 118 simulated vehicles; bias −0.23 km/h, no false records
1.2 km/h
85th-percentile speed
RMSE of the V85 a municipality would see, over 20 simulated traffic runs
≤ 25 m
Recommended zone
from the pole, for a 95th-percentile error under 2 km/h with at least 80 % of vehicles measured (simulation)
1.1 km/h
Tracked point
error tracking the sub-pixel bottom edge; tracking the box centre instead gave 17.4 km/h (simulated)
For engineersHow it is built, its limits, and its keywords.

How it works

Surveyed road points give a homography from the image to metres on the road. Background subtraction finds vehicles, a Kalman tracker follows them through occlusions, and a robust fit of position against time inside a measurement zone gives each speed. Monte Carlo over the calibration gives each speed its uncertainty, and doubtful records go to a person instead of the statistics.

Limits

  • The analysis panels are verified on simulated signals with known noise, vibration and distortion (the Noise Lab recovers the simulated white noise to within 1 %); long captures from the real unit are still to come.
  • Every figure comes from simulated video: a flat, straight road, an ideal lens and box-shaped vehicles. The tool has not been checked against radar or GPS on a real road; a field protocol for that is written. Its first run on real footage, a public motorway clip, has no reference speeds to compare against.
  • The method was tuned on the same simulator, on other seeds, so real video will likely do worse than these numbers.
  • Accuracy falls quickly with distance: at 75 m the 95th-percentile error is 7.6 km/h and fewer than half the vehicles are measured. A lamp post in the line of sight cut the share measured from 86 % to 50 %.
  • Dusk and scenes without cast shadows raise the error to about 1.8 km/h and make the stated uncertainty too small.
  • It is an audit tool for planning, not a certified enforcement device.

Keywords

  • vehicle speed measurement
  • homography
  • multi-object tracking
  • V85
  • road safety
  • traffic camera

Read the write-up →