Computer Vision Simulation for Traffic Violation Detection
Traffic safety remains a critical concern in modern urban mobility, and the violation of red traffic signals is among the most dangerous and frequent forms of non-compliance, contributing substantially to intersection collisions, injuries, and fatalities. Conventional monitoring, which relies on human officers and fixed cameras reviewed manually, is labour-intensive, error-prone, and unable to provide continuous, scalable coverage across the many intersections of a growing city. This study proposes and demonstrates a computer-vision framework for the automatic detection of red-light running, formalised through the logical rule Violation = RedLight ? VehicleCrossesStopLine. The system integrates traffic-light state recognition, vehicle detection through bounding boxes, and stop-line region-of-interest analysis within a sequential processing pipeline comprising frame extraction, preprocessing, detection, and decision modules. A browser-based prototype built with HTML5 Canvas and JavaScript was developed to embody the complete detection logic, enabling red, yellow, and green signal states, a defined stop-line region, and moving vehicles to be evaluated in real time. The system was assessed on 200 simulated events spanning four representative scenarios using accuracy, precision, recall, and F1-score. Experimental results yielded an accuracy of 94.5%, precision of 95.2%, recall of 93.1%, and an F1-score of 94.1%, confirming reliable discrimination between violating and compliant vehicles. The principal contribution is a lightweight, transparent, and extensible detection scheme that provides a foundation for intelligent transportation systems, supporting future integration with CCTV networks, YOLOv8 detectors, web dashboards, and electronic ticketing.