How sampath123123/automatic-number-plate-recognition works
This repository is a video-based automatic licence-plate recognition and vehicle-speed application. Its main workflow reads camera, RTSP, or file frames; detects vehicles; tracks them across frames; detects plates within vehicle crops; recognizes and confidence-votes plate text; then emits one record per vehicle when its track expires. A separate calibration tool builds a view-specific road ruler used for speed estimates. The excerpts show the main orchestration and core algorithms; optional display, recording, and saved plate crops are documented in the README.
Main entry points: alpr.py ALPR runner · road_ruler.py Road ruler · speed_estimator.py Speed estimator · road_calib.json Road ruler data
Components 15
Frame pipeline
- ALPR runner
alpr.py - Annotated video
- Live display
Detection and OCR
- Vehicle detector
detectors.py - Plate detector
detectors.py - Plate OCR
ppocr_rec.py
Tracking and output
- IoU tracker
tracker.py - Vehicle vote record
alpr.py - Detection CSV
- Saved plate crops
Speed calibration
- Road calibration
calibrate_road.py - Road ruler data
road_calib.json - Road ruler
road_ruler.py - Speed estimator
speed_estimator.py
Other components
- Camera or video
Connections 16
- Camera or video → ALPR runner: provides frames
README.md - ALPR runner → Vehicle detector: detects vehicles
alpr.py - ALPR runner → IoU tracker: updates tracks
alpr.py - ALPR runner → Plate detector: detects on crops
README.md - ALPR runner → Plate OCR: reads plate crops
README.md - ALPR runner → Vehicle vote record: accumulates readings
alpr.py - Vehicle vote record → Detection CSV: writes on exit
alpr.py - Vehicle vote record → Saved plate crops: saves best crop
alpr.py - ALPR runner → Annotated video: records frames
README.md - ALPR runner → Live display: shows frames
README.md - Road calibration → Road ruler data: writes ruler data
calibrate_road.py - Road ruler data → Road ruler: loads calibration
road_ruler.py - ALPR runner → Road ruler: loads calibration
alpr.py - ALPR runner → Speed estimator: adds road samples
alpr.py - Road ruler → Speed estimator: converts row to distance
README.md - Speed estimator → Vehicle vote record: supplies speed
alpr.py