Automated speeding ticket framework for NHAI (National Highways Authority of India) using computer vision for vehicle detection, speed estimation, and license plate recognition.
This project developed an automated speed enforcement system designed for Indian national highways (NHAI). The system uses a camera-based pipeline to detect vehicles, estimate their speed using frame-by-frame displacement analysis, and automatically generate speeding tickets by reading license plates with OCR.
The vehicle detection module uses YOLO (You Only Look Once) for real-time object detection, identifying and tracking individual vehicles across consecutive frames. Speed estimation is computed by measuring pixel displacement between frames, calibrated against known road dimensions and camera geometry to convert to real-world speed values.
When a vehicle exceeds the speed limit, the system captures a high-resolution frame, runs OCR-based license plate recognition to extract the vehicle registration number, and generates an automated ticket record with timestamp, speed reading, location, and photographic evidence. The system is designed for deployment on IoT edge devices at highway checkpoints.
class SpeedDetector:
"""Estimates vehicle speed from video using YOLO + displacement."""
def __init__(self, calibration: CameraCalibration):
self.detector = YOLO("yolov8n.pt")
self.tracker = VehicleTracker()
self.calibration = calibration
self.plate_reader = LicensePlateOCR()
def process_frame(self, frame: np.ndarray, timestamp: float):
detections = self.detector(frame)
for vehicle in self.tracker.update(detections, timestamp):
speed_kmh = self.calibration.pixels_to_speed(
vehicle.displacement, vehicle.time_delta
)
if speed_kmh > self.speed_limit:
plate = self.plate_reader.extract(frame, vehicle.bbox)
self.generate_ticket(plate, speed_kmh, timestamp)