摘 要
本文提出了一种基于图像处理的智能交通灯控制系统,旨在通过先进的图像处理技术优化交通灯的配时,以提高交通效率和减少拥堵。系统的核心硬件平台采用STM32微控制器,由图像采集模块、图像处理模块和电源模块三个主要部分组成。图像采集模块利用两个摄像头实时捕捉路口交通情况,而图像处理模块则基于树莓派搭载的OpenCV库进行图像的中值滤波、背景提取、更新以及背景差分算法处理。通过阈值分割,系统能够生成运动车辆的二值化前景图像。进一步地,系统采用改进的加权面积法从二值化图像中准确统计车流信息,包括车辆的存在与否及数量状态。综合各路口的车流信息,系统能够实现对红绿灯的最优配时。此外,电源模块确保了系统的稳定运行。为了验证系统的有效性,我们构建了实物模型并进行了功能测试,结果表明系统能够准确提取路口车辆信息,并在典型路况下实现合理的红绿灯配时。此外,系统还考虑了左转灯的设置,通过增加两个摄像头来监测四个方向的交通情况,以进一步提升系统的准确性和实用性。
关键词:智能交通灯控制系统;图像处理;STM32;OpenCV;车流统计
Abstract
This paper presents an intelligent traffic light control system based on image processing, aiming to optimize traffic light timing through advanced image processing techniques to improve traffic efficiency and reduce congestion. The core hardware platform of the system adopts STM 32 microcontroller, which is composed of three main parts: image acquisition module, image processing module and power supply module. The image acquisition module uses two cameras to capture the traffic situation at the intersection in real time, while the image processing module performs the median filter, background extraction, update and background difference algorithm processing based on the OpenCV library carried by Raspberry Pi. By thresholding, the system is able to generate a binary foreground image of the moving vehicle. Further, the system uses the improved weighted area method to accurately count the traffic flow information from the binarized image, including the presence or absence of vehicles and the quantity status. Integrating the traffic flow information of each intersection, the system can realize the optimal timing of the traffic lights. Furthermore, the power supply module ensures the stable operation of the system. To verify the effectiveness of the system, we constructed a mock-up and conducted functional tests, and the results show that the system can accurately extract vehicle information at the intersection and achieve reasonable traffic light timing in typical road conditions. In addition, the system also considers the setting of the left turn lamp, by adding two cameras to monitor the traffic situation in the four directions, in order to further improve the accuracy and practicality of the system.
Key words: intelligent traffic light control system; image processing; STM 32; OpenCV; traffic flow statistics
7.1 总结 36
7.2 成果 37
7.3 展望 38
参考文献 38