With the rapid development of China's economy,the number of motor vehicles has shown a large-scale increase.Excessive motor vehicles have brought tremendous pressure on urban transport.Traffic congestion has become a major issue that has plagued urban management.Road video surveillance is an important means to solve traffic problems,but individual video surveillance can only see the progress of moving vehicles on the road and can not perform some other intelligent processing,such as: traffic statistics of roads,vehicle violation judgments,etc..The basis for realizing these intelligent processes is to detect and track moving vehicles.Therefore,effective and accurate detection and tracking of moving vehicles has become the most important issue that we need to solve.Research on the detection and tracking of moving targets has always been a hot topic in the field of computer vision.Many domestic and foreign research institutions and scholars have conducted in-depth research on this topic.This article first introduced the OpenCV vision library in detail,including the OpenCV module and the OpenCV installation and configuration process.Then it deeply analyzes the image preprocessing techniques used in the detection and tracking of moving vehicles,including: image graying,smoothing filtering,binarization,and morphological filtering.In the part of motion vehicle detection,several commonly used motion object detection algorithms are introduced: optical flow method,inter-frame difference method,background subtraction method,and then the Gaussian mixture model in the inter-frame difference method and background subtraction method is elaborated.GMM),Vibe algorithm.The advantages and disadvantages of the inter-frame difference method,the Gaussian mixture model and the Vibe algorithm are discussed.After the experimental comparison,the Vibe algorithm with good real-time performance and detection target integrity is selected as the motion vehicle detection algorithm.Aiming at the problem of "ghosting" in the Vibe algorithm,the Vibe algorithm is improved by the inter-frame difference method.The experimental results show that: compared with the original Vibe algorithm,the improved Vibe algorithm based on the inter-frame difference method can quickly eliminate the influence of "ghosting" on the detection results,and has a good detection effect.In the last part of the vehicle tracking,the Meanshift algorithm is introduced in detail.According to its shortcomings,the Camshift algorithm is introduced,namely the continuous adaptive Meanshift algorithm.This algorithm improves the shortcomings of constant window size and position in Meanshift algorithm.However,it does not have good robustness in complex environments,and it is easy to lose the tracking target.Therefore,the Camshift algorithm is improved by using Kalman filter's predictive characteristics.Finally,the improved Camshift algorithm based on Kalman filter and the improved Vibe detection algorithm are used to achieve the multi-objective automatic tracking of moving vehicles.Using OpenCV3.4 and VS2015 for encoding,the video to be tested is tested.The experimental results show that this algorithm has good real-time performance,and it has good robustness to the complex environment and meets our expectations.Through the research of this paper,the moving target detection algorithm and the tracking algorithm are improved.It can accurately identify the moving vehicle and can carry out the automatic multi-target tracking.It has extremely important significance for realizing the intelligent traffic and solving the traffic problem. |