杨丹,戴芳(西安理工大学理学院数学系, 西安 710048)
目的 目标检测在智能交通、自动驾驶以及安防监控中均有重要的地位，ViBe算法是常用的运动目标检测算法，它主要由背景模型初始化、前景检测、背景模型更新3部分组成，其思想简单，易于实现，运算效率高，但当初始帧有运动目标时，检测结果会出现“鬼影”现象，且易受噪声和光照变化影响，不能适应动态场景。同时，其逐帧逐像素进行前景检测，在计算复杂度方面有较大提升空间。为解决这些问题，提出一种改进的ViBe算法，称为ViBeImp算法。方法 在背景模型初始化时，用多帧平均法给出初始背景，采用该初始背景构建初始背景样本模型。在前景检测过程中，采用背景差分法、帧差法与OTSU算法相结合给出半径阈值的自适应计算方法。同时，根据背景差分法找出运动区域，只对运动区域进行前景判断和模型更新，降低算法的计算复杂度。结果 对25个不同场景视频分别给出ViBeImp算法在初始化背景，自适应半径阈值和计算复杂度方面改进的结果及有效性指标，实验结果表明，与ViBe、ViBeDiff2、ViBeIniR，以及Surendra等算法和高斯混合模型相比，ViBeImp算法对噪声、光照和背景动态变化有较好的鲁棒性，检测结果更完整，且实时性较好。同时，ViBeImp算法将ViBe算法的查准率、查全率以及F1值分别提高了17.98%、11.40%和15.96%。结论 ViBeImp算法采用多帧平均法构建初始背景可有效地消除“鬼影”，并给出半径阈值的自适应计算方法，使ViBe算法更快适应视频环境变化，准确且完整地检测出运动目标，具有较低的误检率和漏检率。该方法克服了ViBe算法对初始背景以及视频环境的依赖，很大程度上提高了运算速度，具有很好的鲁棒性和适用性。
Improved ViBe algorithm for detection of moving objects
Yang Dan,Dai Fang(Mathematics Department, School of Science, Xi'an University of Technology, Xi'an 710048, China)
Objective Effective detection of moving objects is a prerequisite in real-time tracking, behavior analysis, and behavioral judgment. Detection of moving objects has been widely applied in the fields of security, intelligent transportation, military, medical, and aerospace. Detection of moving objects is a key issue in the field of computer vision. The common methods used in the detection of moving objects include the optical flow, frame difference, and background subtraction methods. The optical flow method detects the moving region in the image sequence by using the vector feature of moving objects. This method performs well in the case of background motion. However, the computation of this method is complex and time consuming. The frame difference method uses the absolute value of difference between two adjacent frames to detect moving objects. The algorithm is simple and has good robustness. However, the detection results of this algorithm are easily affected by noises and is easy to produce "void". The background subtraction method is the most commonly used method in the detection of moving objects, in which the moving region is detected based on the difference between the current frame and background. The background subtraction method is simple, easy to implement, and can completely extract the object. The ViBe algorithm is a commonly used background subtraction method. This algorithm is mainly composed of background model initialization, foreground detection, and background model update, in which its concept is simple and easy to implement with high efficiency. However, a "ghost" phenomenon occurs in the ViBe algorithm when the initial frame contains moving objects and has the poor adaptability to noise, illumination, and dynamic environment. At the same time, the ViBe algorithm conducts foreground detection on each frame pixel-by-pixel, which has a large room for improvement regarding computational complexity. Thus, in this study, we improve the ViBe algorithm and propose the ViBeImp algorithm. Method In the ViBe algorithm, the construction of the background sample in the first frame of the video that contains the moving objects leads to the appearance of "ghost". Three solutions are used to solve this problem, where the first solution is by changing the manner of background model initialization, the second solution is by accelerating the elimination of the "ghost", and the third solution is by combining with other methods to detect the "ghost" areas and deal with them. The acceleration of elimination of the "ghost" does not fundamentally eliminate the "ghost" and still leads to false detection in the initial part of the "ghost". The combination with other methods in detecting the "ghost" increases the complexity and the amount of calculation of the algorithm. Therefore, we modify the initialization of the background model to eliminate the "ghost". In the ViBeImp algorithm, the initial background used for the initial background sampling model is given by a multi-frame average method, which can eliminate the "ghost" to some extent. Different calculation methods of radius threshold directly affect the performance of foreground detection. A suitable radius threshold can be used to adapt to the changes in light and dynamic scenes in the video, which can effectively reduce the occurrence of missed detection and false detection. Thus, in the process of foreground detection, a self-adaptive calculation method of radius threshold is given by combining the background subtraction method, frame difference method, and OTSU algorithm. At the same time, foreground detection and model update are conducted only in the motion area, which are obtained based on the background difference method to reduce the computational complexity of the algorithm. Result First, the detection results of the ViBeImp algorithm, ViBe algorithm, ViBeDiff2 algorithm, and ViBeIniR algorithm in 25 different scenes that are selected from several public datasets, such as MOTChallenge, CDNET, and ViSOR, are provided with their corresponding precision, recall, and F1 values. Second, the improved detection results and effectiveness of the ViBeImp algorithm in the initialization background, adaptive radius threshold, and computational complexity are given. The ViBeImp algorithm improves the precision, recall, and F1 value of the ViBe algorithm by 13.73%, 3.15%, and 9.44%, respectively, when the background initialization method differs from the ViBe algorithm. The ViBeImp algorithm improves the precision, recall, and F1 value of the ViBe algorithm by 11.14%, 10.09%, and 12.35%, respectively, when the radius threshold calculation method differs from the ViBe algorithm. In terms of computational complexity, the average processing times per frame of the four methods are given, and 19 videos' average processing time per frame of the ViBeImp algorithm is lower than the ViBe algorithm in the 25 videos, which shows the effectiveness of our improvement in computational complexity. Finally, the comparison among the ViBeImp algorithm, Surendra algorithm, and Gaussian mixture model, which are commonly used in the detection of moving objects, is given. The experimental results show that the ViBeImp algorithm is robust to noise, illumination, and dynamic environment with complete detection results and better performance in real-time compared with the ViBe algorithm, ViBeDiff2 algorithm, ViBeIniR algorithm, Surendra algorithm, and Gaussian Mixture Model. Simultaneously, the ViBeImp algorithm improves the precision, recall and F1 of the ViBe algorithm by 17.98%, 11.40%, and 15.96%, respectively. Conclusion The ViBeImp algorithm uses the multi-frame average method to construct the initial background that can effectively eliminate the "ghost". A self-adaptive calculation method of radius threshold is given, which enables the ViBe algorithm to rapidly adapt to the change of video environment and to accurately and completely detect the moving objects. The ViBe algorithm is a kind of algorithm with low false alarm and missed detection rates. The method overcomes the dependence of the ViBe algorithm on the initial background and video environment and reduces the computational complexity to a great extent with good robustness and applicability.