JOURNAL OF COMPUTERS, VOL. 6, NO. 10, OCTOBER 2011
2045
Adaptive Detection of Moving Vehicle Based on On-line Clustering Jian Wu1,2 1.The Institute of Intelligent Information Processing and Application; 2.Provincial Key Laboratory for Computer Information Processing Technology, Soochow University, Suzhou 215006, China Email:
[email protected]
Jie Xia1,2, Jian-ming Chen1,2, Zhi-ming Cui1,2 1.The Institute of Intelligent Information Processing and Application; 2.Provincial Key Laboratory for Computer Information Processing Technology, Soochow University, Suzhou 215006, China
Abstract—Detection of moving vehicles plays a very important role in Intelligent Transport. Aiming at the deficiency of moving vehicle detection, we proposed the adaptive detection method of moving vehicles based on the online clustering. First extracts background adaptively using a new online clustering algorithm which does not need to set any parameters when extract the background image. Then adaptively select the background updating rate according to the road disturbance of background and illumination changes after background building is completed. Finally, realize correct and complete moving object segmentation through foreground detection using background difference. Experimental results show that the proposed method is able to detect moving target accurately in the transport video, it not only has good self-adaptability and real-time but also insensitive to the light changes and background interference. Index Terms—motion detection; clustering; background updating
adaptability;
on-line
I. INTRODUCTION The moving target detection and segmentation of the video are the basis field of computer vision topics. The common moving target detection methods are optical flow, frame difference and background difference etc [1]. Because of its ability to segment the moving object integrity, and achieve real-time motion detection after building the background, the background difference [2] is widely used in video surveillance, traffic automatic monitoring occasions. The background difference method mainly has three parts which are the background extraction, motion detection and background updating. Background extraction is the foundation of background differentia. The common background construction methods are background estimate based on the timeline filter, based on the single Gaussian model [3], based on the mixture Gaussian model [4], based on the Kalman filter [5-6], etc. In this paper, we extract the background by online clustering method from the difference background.
© 2011 ACADEMY PUBLISHER doi:10.4304/jcp.6.10.2045-2052
The document [7] extracts the background using the K-means clustering. In [8], it extract the background through K-means cluster the change of pixels which recorded by three dynamic triples. However the above method did not take into account the limitation of the Kmeans clustering in the background extraction applications: preestablish the number of clusters. In [9] it extract the background using online cluster for the pixel gray values, and set the value of background by certain frequency threshold which not only solve the limitation of preestablished the number of clusters but also avoid the prestoed of a large number of pixel values. However, this method still needs to manually set up two kinds of thresholds and can not extract background self-adaptive for different video. In our previous work that paper [10] has further study in the background extraction, we proposed an adaptive online clustering algorithm with adaptive clustering threshold to cluster the video pixel, which overcome the shortcomings ordinary clustering methods require manual set threshold values and the lack of self-adaptability to different videos. The most direct method to update background is periodically update strategy that by background reconstruction algorithm to rebuild the background with a certain interval of time or a certain number of frames [11]. However the background is constantly changing, so the background model has adaptability to the background disturbance and light change and it must be updated in real time to prepare for the next moving target extraction for the whole detection process. In order to reflect the latest situation of the background including background disturbance, light changes etc, this paper presents a background updated model considered all the above factors. Based on the analysis of the above factors, we present the vehicles adaptive detection method based on online cluster. First we use a new background extraction algorithm based on online cluster to overcome the defects of manually set various thresholds. Then select the background updating rate adaptively according to the road disturbance of background and illumination changes
2046
JOURNAL OF COMPUTERS, VOL. 6, NO. 10, OCTOBER 2011
after background building is completed. Finally, realize correct and complete moving object segmentation through foreground detection using background difference.
the current frame and the former. If the result greater than cluster threshold of the last time then update it with α , otherwise the clustering threshold does not change. (2) Cluster
II. VIDEO BACKGROUND EXTRACTION
to the existed various Calculate distance from t gray-class cluster centers to find the nearest gray-class category j :
There are two key parameters to extract video background with the cluster method: the number of clusters k and the clustering threshold α. We can use clustering approach with known number of clusters directly when the number of clusters k is specified prior. But the lack of a prior knowledge of video scene, the pixels should be gathered into several categories are uncertain in advance. Therefore, we can use the gray online clustering to resolve this problem. However this method did not realize the effect of clustering threshold α to the whole algorithm. Cluster threshold α is to determine cluster standards of pixels. When the new gray data arrives, if the distance between the new gray values to the gray center less than the threshold value α then it will be fell under the class, while adjusting the center of gray cluster and number of classes; otherwise a new gray class will be created and initialize the new class centers and the number. Therefore, the threshold value α is very important: if the value is too small, the excessive number of clusters not only ineffective but also the computation was expensive; otherwise the extract effect of the background is poor because the big difference of two gray values will be classified as a class. In this paper, we cluster the video pixels online by the adaptive online clustering method with the adaptive updated clustering threshold, which overcomes the shortcomings ordinary clustering methods require manual set threshold values and the lack of self-adaptability to different videos. Let
Ft
I t ( x, y )
be the t frame of video,
is the gray
( x, y ) . Ci ( x, y ) represent the cluster value of pixel point i,
mi ( x, y )
is the element number of the cluster i , clustering threshold α is initialized to 0, then for each
( x, y )
in the video training frame 1 − N , the pixel algorithm can be specifically described as follows: Step1: In the t = 1 frame, initialize the first cluster,
C1 ( x , y ) = I t ( x , y )
m1 ( x, y ) = 1
(1)
(2) Which, formula (1)(2) were used to initialize the cluster centers and the number of elements contained in the class. Step2: When the frame steps are: (1) Renew threshold
t (t ≤ N )
arrives, the following
α = arg max ( arg max | Ft ( x, y ) − Ft −1 ( x, y ) |,α ) arg max | Ft ( x, y ) − Ft −1 ( x, y ) |
(3)
is used to find the Which, largest absolute value of gray pixels difference between © 2011 ACADEMY PUBLISHER
I ( x, y )
j = arg min | I t ( x, y ) − Ci ( x, y ) |
(4) Further to determine the relationship between the closest distance and clustering threshold α , if
| I t ( x, y ) − C j ( x, y ) | ≤ α
(5)
I ( x, y )
should be classified to the gray Then t category, make the following update on the gray category. C j ( x, y ) × m j ( x, y ) + I t ( x, y ) C j ( x, y ) = m j ( x, y ) + 1 (6)
m j ( x, y ) = m j ( x, y ) + 1
(7) Which equation (6) is used to update the cluster centers of the gray category, essentially is calculate arithmetic mean of all gray values. Equation (7) is used to update the gray elements number. I ( x, y )
and the If the relationship between the gray t closest gray-class does not meet the formula (5), a new C ( x, y ) should be created, and initialize: gray-class i +1
Ci +1 ( x, y ) = I t ( x, y )
(8)
mi +1 ( x, y ) = 1
(9) (3) Statistic the number of clustering elements, with the cluster centers of largest cluster (containing the largest number of elements) as the current background value of pixels.
m ' ( x, y ) = arg max ( m1 ( x, y ) , m2 ( x, y ) , ⋅⋅⋅) Bt ( x, y ) = Cm '( x , y ) ( x, y )
(10)
(11) Which formula (10) is used to find the largest cluster,
( x, y )
formula (11) set the background value of pixels to its corresponding cluster center value of the largest cluster in moment t . Carried out the above steps for each pixel in the training frames, we can continuously obtained the new background value of each pixel until the end of the training frame. In the cluster process clustering threshold updates adaptive and gradually toward the trend that the background frame difference larger. The gradually increasing of threshold suppress the increases of clusters number while speeding the convergence rate of clustering. The dynamically updated of threshold with good self-adaptability on different video, avoiding the adverse background extraction of the traditional clustering method using a fixed threshold.
JOURNAL OF COMPUTERS, VOL. 6, NO. 10, OCTOBER 2011
III. DETECTION OF MOVING VEHICLES A. Background Difference Method Given a series of consecutive images, we set the current frame as the k frame, and denoted by Ck(i,j) , while the current background is Bk(i,j). Compute the absolute difference of each frame and its background, and we can get the foreground binary image after threshold segmentation. ⎧1 , if Ck (i , j ) − Bk ( i , j ) ≥ T D k (i,j)= ⎨ 0 , otherwise ⎩ (12) D (i,j)
is the target mask, while 1 is the Where the k pixel of the moving object and 0 the pixel of the background. The pixel with large difference takes a small part of the image and corresponds to the foreground vehicles, otherwise the pixel to the background. Since the background of the traffic video is dynamic, we cannot get the binary image basing on a fixed threshold. A bad threshold will result in a inaccurate segmentation, and affect the final results. In this paper, we get the adaptive threshold with the difference image. In the difference image, most value of the pixels is low and only a small part of the pixels has high value. So it appears in the histogram of the difference image that the area of the low value will has high value, while the area of the high value has low value. Get the peak of the histogram and take 10 percents of the peak as the best T. Since the edge of the moving object will not be lost during the process of subtraction, we can detect the edge of the moving vehicle in the binary mask image using Canny method, and take advantage of this edge to join the moving vehicles as a connected region to form the foreground. B. Adaptive Background Update In the process of the detection of the moving vehicles, we must establish a suitable model to update the background, so that we can abstract the moving object accurately in real-time. As the background is changing, in order to make the background model be adaptive to the background and light change, we must update the background model in real-time to abstract the object next time and let the detect process continue. But we must notice for the excessive update when the background of the video is slightly changed. It is hard to control speed of the updating when the environment is complicated. There are four influence factors as follow. (1) Change caused by moving targets. For example, someone bring something in or take anything out from the background, the bus enters or leaves the background, or some people or animal stop after moving in the scene. (2) Interfere by the moving object itself. It is difficult to update the background of the road mostly owning to the similarity of the window and other parts of the vehicle and the background of the road in the traffic video. (3) The background disturbance. For example, the video camera slightly twitter, the branch of the trees in the video swing, or the water waves etc. © 2011 ACADEMY PUBLISHER
2047
(4) The change of the light. For example, day and night alternate, the lightning and other natural change of illumination, or the shadows projected to the background. Take into account the above mentioned factors, this paper suggest a method fusing the above information to update the background. Suppose that the background of the k-1 frame expressed as Bk-1 , the background of the current frame is Bgk, , the updated background is Bk. The update model is shown in the formula (13).
Bk = (1 − γ ) Bk −1 + γBg k
(13)
Where γ is the update rate, whose value range is [0, 1]. When the background changes intensely, we should
enhance the value of γ , so the background can be updated in time. Inspired by the paper [12], take the two factors of background disturbance and illumination changes into consideration, we generate the control
strategy of the γ factor. The primary reason leading to the changes of the background is background disturbance and illumination changes. (1) The influence of the background disturbance. The area with peak value of the histogram of the difference image is the region concentrating the pixels of the background. So we can analyze the influence of the background by the way of analyzing the pixels change rate of the background. We can get the difference image by subtracting the k frame from the k+1 frame. Suppose that the max point of the histogram of the difference image is corresponding to the gray value f point. Then we can count the sum of the pixels in the range of [f-10, f+10] in the difference image, denoted by Tk. In the same way, we get the sum of the pixels in the k-1 frame, denoted by Tk-1.
| Tk − Tk −1 | max(Tk , Tk −1 )
γ1 =
(14) (2) The influence of the illumination. When the illumination change in the environment, the change of the brightness of background in the usual scene is steady, so we can sense the change of the illumination by compare the average brightness value of the front and rear frame. At the same time, according to the information we can alter the factor γ the speed of the background updating. Let the average value of all the background pixels in the k frame is Lk , it indicates the brightness of the background in the k frame, while the average value in the k+1 former frame is Lk-1.
γ2 =
| Lk − Lk −1 | max( Lk , Lk −1 )
(15) (3) Take comprehensive consideration the influence of the illumination and background disturbance.
γ = µ1γ1 + µ2 γ 2
Where
µ1
and
µ2
(16)
are set constants, 0 ≤ µ1、µ2 ≤ 0.5 .
We can get from the above formula that the γ increase and the background updating is faster when the
2048
JOURNAL OF COMPUTERS, VOL. 6, NO. 10, OCTOBER 2011
background disturbance is intense and the illumination change is intense too. IV. EXPERIMENTAL RESULTS AND ANALYSIS A. Extraction the Background of Traffic Video In the background extraction session, we will compare the background extraction algorithm proposed in this paper with the traditional online clustering method using multiple video data. The result is shown in Figure 1 to Figure 6. For each video, we use the former 100 frames as a training video for the background extraction. Video 1 is a typical single mode highway scenes video, the scene has frequency stability of vehicles in and out, and traffic in video is relatively sparse. Figure 1 is the result of using traditional online clustering. In which (a) - (c) are backgrounds with different clustering threshold values α . As the pictures shown, the setting of clustering threshold parameter has effect on the background extraction. Meanwhile, it’s found that when clustering threshold is too small, due to excessive number of clustering, experimental time take a longer period. Figure 2 is the result of experimental approach of this paper. (a) (b) are the beginning and the end frames in training video , (c) is the background extracted by experimental approach of this paper. Because of the elimination of restrictions on the number of clustering and application of adaptive dynamic clustering threshold, the convergence is faster and background clustering has better extract.
(c) α = 20 Figure 1. Traditional on-line clustering method
(a) The 1st frame
(b) The 100th frame
(a) α = 5
(c) Extraction of the background Figure 2. Adaptive on-line clustering method
(b) α = 10
© 2011 ACADEMY PUBLISHER
Video 2 is a heavy traffic video. In particular, vehicle flux in traffic on the upside of the video is heavy, and there are many stop-go cars. Figure 3 is the traditional method of online clustering results of the background extraction. Although remove the restrictions of the cluster number, a variety of background extraction results is clearly caused by different clustering thresholds, shown in Figure 3(a)-(c). Through experiments constantly adjust the threshold, until α = 80 is method in this paper only get a better background. Figure 4 is the result of experimental approach of this paper. (a) (b) are the beginning and the end frames in training video, (c) is the background extracted by experimental approach of this
JOURNAL OF COMPUTERS, VOL. 6, NO. 10, OCTOBER 2011
2049
paper. Do not need to set the clustering threshold method of this paper can achieve the desired effect of the background extraction.
(c) Extraction of the background Figure 4. Adaptive on-line clustering method (a) α = 15
(b) α = 25
Video 3 is the PETS standard test video. Surveillance camera in the scene has always been a minor shake. Figure 3 shows comparative result of three ways of background extraction. Figure 5 is a traditional online clustering method results, from (a) to(c) we can see that different clustering methods cause a variety of background extraction results. Figure 6 is the result of experimental approach of this paper. In which (a) (b) are the beginning and the end frames in training video, (c) is the background extracted by experimental approach of this paper. Compared with the other methods, this method does not need to set any threshold of the background; it can achieve better extraction automatically.
(c) α = 80 Figure 3. Traditional on-line clustering method
(a) The 1st frame
(b) The 100th frame
(a) α = 10
(b) α = 20
(c) α = 40 Figure 5. Traditional online clustering method
© 2011 ACADEMY PUBLISHER
2050
JOURNAL OF COMPUTERS, VOL. 6, NO. 10, OCTOBER 2011
(a) The 1st frame
(b) The background updated in this paper
(b) The 100th frame
(c) The method in the document [13]
(c) Extraction of the background
(d) The detection method in this paper
Figure 6. Adaptive on-line clustering method
Figure 7. Comparison of the method in this paper and the traditional method of the background difference [Video 1]
B. The Vehicle Detection Compared the background update and vehicle detection algorithm presented in this paper with the methods in the document [13], the results of Video 1, Video 2 and Video 3 are shown in Figure 7, figure 8 and Figure 9. And, (a) is an frame of the original video, (b) is the current background updated with learning rate in this paper, (c) is the result detected by the method in the document [13],(d) is the result detected by the algorithm in this paper.
(a) The 377th frame of the original sequence
© 2011 ACADEMY PUBLISHER
(a) The 105th frame of the original sequence
(b) The background updated in this paper
JOURNAL OF COMPUTERS, VOL. 6, NO. 10, OCTOBER 2011
(c) The method in the document [13]
2051
(d) The detection method in this paper Figure 9. Comparison of the method in this paper and the traditional method of the background difference [Video 3]
(d) The detection method in this paper Figure 8. Comparison of the method in this paper and the traditional method of the background difference [Video 2]
The background difference is to detect the vehicle by subtracting operations of the foreground frame and the background frame, binarization and projection to the original frame and so on. Therefore, the vehicles which color close to the road background is prone to produce larger error in the segment, especially the information like the edge prone to be fuzzy and lost. As we can seen from the experimental results of video 1, video 2 and video 3, compared to the method in the document [13] there is marked improvement in this paper. To get a more complete and clear foreground images of vehicles, there are three steps in this paper: firstly, it is used learning rate which excludes the impact of light and background disturbances to update the background; secondly, it detects the edge of the moving vehicles in the binarization template image using the method of Canny edge detection; finally, it connects the moving vehicles in the current frame images to a connected region. VI. CONCLUSION
(a) The 539th frame of the original sequence
(b) The background updated in this paper
In this paper, we proposed a adaptive detection method of moving vehicles based on clustering online for shortcomings in the detection of common moving vehicles. First, it is used a new background extraction algorithm based on clustering online. The algorithm does not need to set any parameters when extracting the background. It can extract the background image adaptively. After background building is completed, it will select background update rate adaptively according to the background disturbance of the road and illumination changes. Finally, it will achieve a correct and complete segmentation of moving object by detecting the foreground with the method of differential background. It is showed in the experimental results that the method in this paper is able to detect the moving target in the transport video accurately, not sensitive to light changes and background interference and has a better self-adaptability and real-time characteristic. ACKNOWLEDGEMENT
(c)The method in the document[13]
© 2011 ACADEMY PUBLISHER
This research was partially supported by the Natural Science Foundation of China under grant No. 60970015, the 2008 Jiangsu Key Project of science support and selfinnovation under grant No. BE2008044, the 2009 Special Guiding Fund Project of Jiangsu Modern Service Industry (Software Industry) under grant No. [2009]332-
2052
JOURNAL OF COMPUTERS, VOL. 6, NO. 10, OCTOBER 2011
64, the Project of Jiangsu Key Laboratory for Computer Information Processing Technology grant No.KJS0924, the Applied Basic Research Project (Industry) of Suzhou City under grant No. SYJG0927 and the Beforehand Research Foundation of Soochow University. REFERENCES [1]. R. J. Radke, S. Andra, O. Al-Kofahi, B. Roysam. Image Change Detection Algorithms: A Systematic Survey, IEEE Transactions on Image Processing, 2005, 14(3):294307. [2]. Magee D. Tracking mu1tiple vehicles using foreground, background and motion mode1s[J]. Image and vision Computing, 2004, 22(2):143-l55. [3]. C. Wren, A. Azarbayejani, T. Darrell, etc. Pfinder:Realtime tracking of the human body[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 1997, 19(7):780-785. [4]. Stauffer C, Grimson W E L. Adaptive Background Mixture Models for Real-time Tracking. Proc of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition, Fort Collins, USA, 1999, :246252. [5]. C Ridder, O Munkelt, H Kirchner. Adaptive Background Estimation and Foreground Detection Using KalmanFilter. Proc of the International Conference on Recent Advances in Mechatronics, Istanbul, Turkey, 1995:193199. [6]. Zhu Zhengtao, Zeng Jiangxiang, Wang Zhiping. The Background Estimation Based on Karmann filter and it’s Realization Using Halcon Function[J]. Microcomputer Information. 2007, 28, 291-293. [7]. Zhang Yunchu, Liang Zize, Li En, Tan Min. A Background Reconstruction Algorithm Based on C-means Clustering for Video Surveillance[J]. Computer Engineering and Applications. 2006, 42(14):45-47. [8]. Zha Cheng-dong WANG Chang-song GONG Xian-feng ZHOU Jia-xin. Background generation based on modified K-means clustering algorithm[J]. Computer Engineering and Design, 2007, 28(21):5141-5143. [9]. XIAO Mei, HAN Chong-Zhao. Background Subtraction Algorithm Based on Online Clustering[J]. Pattern Recognition and Artificial Intelligence, 2007, 20(1):35-41.
© 2011 ACADEMY PUBLISHER
[10]. Xia Jie, Wu Jian, Chen Jianming, Cui Zhiming. Background Extraction Based on The Adaptive Online Clustering[J]. Computer Engineering. Accepted. Yao, CHANG Fa-liang. Background [11]. ZHAO reconstruction algorithm based on symmetrical differencing[J]. Computer Engineering and Applications, 2008, 44(6):104-106. [12]. Hu Jianhua, Yang Fan, Xu Jianjian. Motion detection based on blocks frame difference and background subtraction[J]. Electronic Measurement Technology, 2007, (10):49-53. [13]. LIN Hongwen, TU Dan. Moving Objects Detection Method Based on Statistical Background Model[J]. Computer Engineering, 2003, 29(16):97-99. Jian Wu was born in Nantong on the 29th April, 1979, and got master degree in the field of computer application technology from Soochow university, Suzhou city, China in 2004. The main research direction is computer vision, image processing and pattern recognition. He works as a teacher in the same college after his master graduation. Now he is pursuing the doctoral degree. He was awarded the Third Prize of 2007 Suzhou City Science and Technology Progress and the 20082009 Soochow University Graduate Scholarship Model. Jie Xia was born in Hefei on the 20th January, 1986, and got bachelor's degree in the field of computer application technology from Anhui Normal university, Wuhu city, China in 2007. And now she is studying in Soochow university to pursue the master degree. Her main research direction is image processing and video retrieving. Jian-ming Chen was born in Suzhou on February, 1960. Associate professor, Master Supervisor. The main research direction is intelligent information processing and software engineering. Zhi-ming Cui was born in Shanghai on the 4th July, 1961. Professor, PhD Candidate Supervisor. The main research direction is deep web and video mining.