Real-time traffic classification and volume count using automated image processing
Afzan Kamarudin, Intan Shafika Saiful Bahri, Anas Ibrahim, Li-Sian Tey, Wei Keong Kuan, Noryani Natasha Yahaya, Ahmad Puad Ismail · 2025
Conventional vehicle counting using various techniques such as manual counts are no longer efficient in the era of industrial revolution 4.0. The algorithm within the intelligence system using a real time video and image processing technique is proposed due to its reliability, efficiency, cost effectiveness and safety for gathering data. Surveillance cameras commonly installed in large cities could be used to obtain traffic data recording, allowing for an automated system to be easily adopted at minimal cost. This study provides an alternative and economical means to estimate traffic density via video-image processing which adopts OpenCV in the Python code. This method only requires a fixed video camera be positioned at an elevated position such as on a pedestrian bridge or a light pole. The images are processed automatically through OpenCV code bindings in Python. The system requires frames from the video to be captured so background subtraction can be performed to detect and count the vehicles using Gaussian Mixture Model. The classification of vehicles by size is done by comparing the contour areas to the assumed values. The proposed algorithm can be adapted to meet the requirements of the user and the camera’s position. The algorithm allows traffic data to be obtained, which may assist local authorities make decisions regarding urban planning and the design of transportation systems. Sample videos of traffic scenes were used to compare the detection and classification of vehicles. Results from the proposed algorithm were compared with manual count results from the field. Analysis of the classification and volume count of vehicles using the proposed algorithm is shown to have an error rate of 1.3% compared to an error rate of 6.4% using the manual tally counter method. The results confirmed that the proposed automatic counting system performed better when compared to the manual tally counter method with the additional benefits of increase cost efficiency and improved safety for traffic data collection.