David H. Simangunsong
Back to Computer Vision

Vehicle counting and plate reading from road video

Vehicles in recorded road video are detected, tracked and counted at a line, plates are read across several frames, and speed is estimated only where the camera was calibrated.

Year
2024
Study area
Public road footage, outside Indonesia
Period
Four public recordings
Methods
Object detectionMulti object trackingOCRCamera calibration
Stack
PythonOpenCVPyTorchFastAPISQLite
  • 28 of 28Westbound vehicles counted in the first minute of the N4 drone survey
  • 11 of 12Labelled plate photos read exactly
  • 4.1 km/hMean speed error on six test passes, against 1.0 km/h for a constant guess

Problem

Road agencies need vehicle counts by direction, and enforcement needs plates and speed. A fixed camera can supply all three, but each one fails in a different way, and speed needs the camera measured first.

Method

From video to a table linked to timestamps.
From video to a table linked to timestamps.

A pretrained detector finds vehicles and a tracker keeps one ID per vehicle. A vehicle is counted once when its track crosses the line. Plates are read on several frames and kept only when the readings agree. Speed uses a camera calibration fitted on training passes of the test road.

Results

On the first minute of the N4 drone survey, 28 westbound vehicles were counted, the same number listed by the source.

The plate reader read 11 of 12 labelled photos exactly. On the road clips it read 35 of 61 plates in daylight and 14 of 35 at dusk.

On six held out passes with known speed, the mean error was 4.1 km/h. A constant guess at the training mean was off by only 1.0 km/h, because the passes were all near 30 mph.

Use

Counting and plate reading on a fixed camera. Speed needs a calibration for each camera and a test with a real spread of speeds.

Interactive

Road video replay with counts and plates

Self contained HTML, served from this site

Open in a new tab

Limitations

What these results should not be used for.

  1. Speed is calibrated for one test road only. All six test passes were driven at nearly the same speed, so speed accuracy is not proven.
  2. Plate readings on the road videos have no ground truth.
  3. No night, rain or congested footage has been tested.