The Dynamic Background Generation Scheme Using an Image Frame Statistical Comparison Method *1, Corresponding Author Wen-Yuan Chen, Department of Electronic Engineering, National Chin-Yi University of Technology, Taiwan, Republic of China, cwy@ncut.edu.tw 2, Chuin-Mu Wang, Department of Computer Science and Information Engineering, National Chin-Yi University of Technology, Taiwan, Republic of China, cmwang@ncut.edu.tw Abstract This paper is developing a dynamic background generation scheme for color video sequences. We calculate the pixels vibration and statistics for the 32 clusters to develop an effective background generation method in color video sequences. Since the color image has computation consumption problems, we use a color quantization technique to shrink the pixel value from 256 into 32 grayscales called 32 clusters firstly. And we find the main value of the pixel by a cluster statistic stage which static several frames of the video sequence. After a statistical analysis, it will have several clusters. We check and find the maximum cluster (FMC) as the pixel value for further processing. Since the background has two parts: static part and dynamic part, we measure the probability of pixels (BP) and judge if it belongs to static background or dynamic background. If the BP is less than a threshold SP we process, it is the static background. Otherwise it is the dynamic background. Finally, by adding the static background and dynamic background, the completed background is generated. In order to demonstrate our scheme is an effective method, several test sequences are used for simulations. According to the test results, it is evident that our scheme can exactly obtain an integrated color background from the color video sequences. Keywords: Background Generation, Video Sequence, Dynamic Background, Object Extraction 1. Introduction Protecting a country s borders is vital to its homeland security. Similarly, the intelligent monitor system is widely used for community security. However, it is very challenging to detect potential objects. It includes the intelligent traffic flow static system; Security Automation System includes TV monitor system, petrol system, alarm system, entrance security control system, car park control system, and intelligent energy saving system by image processing. The above systems all need image object extracting techniques means also need background generation techniques. Nowadays, the intelligent monitor system is widely used in the human life; it usually uses the web camera to detect objects. Several methods found are used to extract the objects and are listed in the following. 1) Background subtraction method: It is a kind of easier methods. It makes a background model and let the current frame subtract the background to extract the objects. Several researchers [1-3] proposed the model whose advantages are that the background can be exactly created and easily completed. 2) Continuous image subtraction: It can achieve the goal by subtracting the neighbor frames in the sequences to extract the objects. Obviously, it does not need to pre-create the background to adapt to the environment well. However, if the object is still, then the objects are hard to be detected, which is its disadvantage. 3) Features extraction: The algorithm extracts objects by the characteristics of the detected objects. Through carefully designing, it can obtain effective results. However, it has a poor versatility. 4) Optical flow method: This method detects the object moving distance and orientation by calculating the optical flow according to the continuous image. It can extract the objects independently without needing to consider scenarios. However, it has he computational complexity drawback and the timely detection is difficult and time-consuming. This research is based on the background of the inter-frame differences and calculates the spread of the pixels to extracting objects methods. Chung-Cheng Chiu [4] proposed a statistical method of background pixel classification of extraction. Jun Kong et al. [5] proposed a method using the high probability of convergence method to extract objects. Scholars have discussed over whether the proposed methods to extract objects require time in the background or the scene adaptive background updates the winning god reputation for performance. Other researches can be found in [6]-[11]. The International Journal of Advancements in Computing Technology(IJACT) Volume4, Number18,October. 2012 doi: 10.4156/ijact.vol4.issue 18.24 205
remainder of this paper is organized as follows. In Section 2, we present the object extraction algorithm. The empirical tests are shown in Section 3. Finally, a conclusion of this paper is shown in Section 4. 2. The System Algorithm For an object extracting from video sequences, a corrective dynamic background image is the kernel work. Here we calculate the pixels vibration and statistics for the 32 clusters to develop an effective background generation method in color video sequences. Figure 1 shows the dynamic and static backgrounds generation flow chart. We used the static background to extract static objects and used the dynamic background to extract the object in the dynamic part. In the system, we generate the background based on R, G, and B planes, respectively. Since the color image has computation consumption problems, we use a quantization technique to shrink the pixel value from 256 into 32 grayscales firstly. Next, we find the main value of the pixel by a cluster statistic stage which static several frames of the video sequence. If the background is dynamic, then the pixels of the area will be on the vibration state. After statistical procedure, it will have several clusters. We check and find the maximum cluster (FMC) as the pixel value for further processing. We called the pixel value as the vibration amount (VA) because it is obtained by static several frames of the video sequence. Certainly, at the initial state, the VA is so big that we need to wait for several times. Once the VA is less than the threshold VT, we can start the system. Since the background has two parts; static part and dynamic part, we measure the probability of pixels (BP) and judge if it belongs to static background or dynamic background. If the BP is less than a threshold SP we process, it is the static background. Otherwise it is the dynamic background. It is easier to obtain the objects (OGbSB) by using the video frame subtracting the static background. On the other hand, for dynamic background part, we compare between the video frame and the dynamic background to get the error values e C. We check the e C ; if it is less than the threshold D T then it is the background and can be neglected. Otherwise it is object under the dynamic background. Finally, by adding the static object and dynamic object, the objects extracting from the dynamic background sequences is completed. The details can be found in figure 1 and are described in the following. VA FMC VA V T BP S p ec D T Figure 1. The system algorithm 206
2.1 Color Quantization Since the color image has 24 bits, it has computing consumption problems. Thus, we adopt a color quantization method to reduce the color scales from 256 into 32 clusters for R, G and B planes, respectively. The formula of color quantization is as follows: RC( ceil Fn ( y,1) 0.014/8 GC( ceil Fn ( y,2) 0.014/8 BC( ceil F ( y,3) 0.014/8 n Where RC (, GC ( and BC( are the cluster results from the video sequence n-th frames: F n ( y,1), F n ( y,2), and F n ( y,3), which are corresponding to the red, green and blue frames, respectively. 2.2 Background Generation In this study, two type backgrounds are static background and dynamic background. In accordance with intuition, if the vibration rate of the pixel is less than a threshold SP from statistics for some time, we consider that it belongs to the static background. Otherwise it belongs to the dynamic background. It is easier to obtain the objects (OGbSB) by using video frame subtracting the static background. On the other hand, for dynamic background part, we compare between the video frame and the dynamic background to get the error values e C. We check the e C ; if it is less than the threshold D T, then it is the background which can be neglected. Otherwise it is the object under the dynamic background. To speed up the calculation, we let the pixels reclassified into 32 clusters by a color quantization technique. In this paper, the static and dynamic backgrounds are generated by different criteria. Based on test results, the two kinds of backgrounds are all correctively created. The equation (2) is the clustering formula on each frame. (1) BR( [ BR( [ 1 BG( [ BG( [ 1 BB( [ BB( [ 1 if RC( i if GC( i if BC( i (2) Where BR ( [ BG ( [ BB ( [ denote the clusters i from 1 to 32 corresponding to the R, G, and B planes. The RC (, GC (, and BC ( are expressed pixels located on x and y coordinates for R, G and B planes respectively. The static background or dynamic background is decided by equation (3). It checks the vibration rate of the pixel. If the maximum vibration rate is less than the threshold S P, then we get the static background. Otherwise we get the dynamic background as shown in formula (3). 207
BR( [ / N SP & maxbg( [ / N SP maxbb( [ / N S max If & P SBR( MAX ( RC( )*8 4; Then SBG( MAX ( GC( )*8 4; SBB( MAX ( BC( )*8 4; DBR( MAX ( BR( [ ); Else DBG( MAX ( BG( [ ); DBB( MAX ( BB( [ ); (3) Where N is the number of frames used in statistical analysis, S P is the threshold used to judge static background or dynamic background, and SBR (, SBG( and SBB( express the static backgrounds corresponding to the R, G, and B planes, respectively. DBR (, DBG (, and DBB( denote the dynamic backgrounds corresponding to the R, G, and B planes, respectively. Figure 2 shows the background generation case. Figure 2(a) is one of frames of the original video sequence, and figure 2(b) is the clusters data from the color quantization of the R plane. Similarly, figure 2(c) and 2(d) are the clusters data from the color quantization of the G plane and B plane, respectively. (a) (b) (c) (d) Figure 2. Background generation; (a) one of frames of the original video sequence, (b) the clusters data from the color quantization of the R plane, (c) the clusters data from the color quantization of the G plane, (d) the clusters data from the color quantization of the B plane. 2.3 Image Repairing The median filter is a nonlinear spatial filter, and is a powerful tool at removing outlier type noises. It does the good job at preserving edges of an image. The filter mask simply defines what pixels must be 208
included in the median calculation. The computation of the median filter starts at ordering those n pixels defined by the filter mask from minimum to maximum value of the pixels as given in equation (4). F 0 F1 F2 F n 2 Fn 1, (4) where F 0 denotes the minimum and F n1 is the maximum of all the pixels in the filter calculation. The output of the median filter is the median of these values and is given by Fn / 2 Fn / 21 for n even Fmed 2 (5) Fn / 2 for n odd Typically, an odd number of filter elements is chosen to avoid the additional step in averaging the middle two pixels of the order set when the number of elements is even. Since the moving objects extracting could cause some imperfect of all the images, including environment variation, threshold value setting, and data statistic error. Thus we adopt the median filter to filter out the noise to obtain a smooth background. 3. Empirical results The environment of simulation is described in the following. The personal computer is equipped with Intel(R) Core(TM) i5 CPU 2.40 GHz and 79GB RAMS. Simultaneously, Windows 7 Home Premium and Matlab R2010a software are used. The video sequence is generated by a CMOS digital camera with 320 x 240 pixels and under 25 frames per second. In the video sequence simulation, we use three kinds of scenes: the indoor, outdoor and corridor to demonstrate the effective of the scheme. Besides, the variant luminance is also used for testing. Figure 3 shows the outdoor scenes testing example. Figure 3 is simulation results-1: figures 3 (a1)-(a8) are the frames 250, 256, 263, 271, 279, 283, 292, 300 of the original sequence. Figures 2 (b1)-(b7) are the extracted backgrounds corresponding to the (a1)-a(7), respectively. Finally figure 3(c) is the final extracted background. Figure 4 (a1)-(a4) are the original test images. Figures 4 (b1)-(b4) are the extracted backgrounds corresponding to the (a1)-a(4),respectively. And figures 4(c1)-c(4) are the final extracted objects. Figure 5 shows the simulation results-4. Figures 5(a1)-(a5) are the frames 421, 426, 457, 500, 631 of the original sequence, and figure 5(b1)-(b5) denote the extracted static background images corresponding to the (a1)- (a 5),respectively. Figures 6(c1)-(c5) show the extracted dynamic background images corresponding to the (a1)- (a 5),respectively. Finally, the figures 6 (b5) and c(5) are the extracted static background and dynamic background, respectively. Figure 7 shows the background generation. Figure 7(a) is one of frames of the original video sequence, and figure 7(b) is the clusters data from the color quantization of the R plane. Similarly, figure 7(c) shows the clusters data from the color quantization of the G plane, and figure 7(d) expresses the clusters data from the color quantization of the B plane. Figure 8 shows the simulation results of case 6. Figure 8 (a1)-(a5) are the frames 261, 266, 300, 350, 408 of the original sequence, figure 8 (b1)-(b5) are the extracted static backgrounds corresponding to figure 8 (a1)-(a5), respectively. Finally, figure 8 (c1)-(c5) are the extracted dynamic background corresponding to figure 8 (a1)-(a5), respectively. By the way, figures 9 to 13 are the others video sequence used for simulations. They are used to evident that our scheme is an effective and correct method for a dynamic background generation method from the color video sequence. 209
Figure 3. Simulation results-1: (a1)-(a8) the frames 250, 256, 263, 271, 279, 283, 292, 300 of the original sequence, (b1)-(b7) are the extracted backgrounds corresponding to the (a1)-(a7), respectively, (c) the final extracted background. Figure 4. Simulation results-3: (a1)-(a4) the original image, (b1)-(b4) the extracted backgrounds corresponding to the (a1)-(a4), (c1)-(c4) the final extracted objects corresponding to the (a1)-(a4), respectively. 210
Figure 5. Simulation results-4: (a1)-(a5) the frames 421, 426, 457, 500, 631 of the original sequence, (b1)-(b5) the extracted static backgrounds corresponding to the (a1)-(a5), respectively, (c1)-(c5) the extracted dynamic background corresponding to the (a1)-(a5), respectively. Figure 6. Simulation results-5: (a1)-(a5) the frames 2, 21, 80, 101, 152 of the original sequence, (b1)- (b5) the extracted static backgrounds corresponding to the (a1)-(a5), respectively, (c1)-(c5) the extracted dynamic background corresponding to the (a1)-(a5), respectively. (a) (b) (c) (d) Figure 7. Background generation; (a) one of frames of the original video sequence, (b) the clusters data from the color quantization of the R plane, (c) the clusters data from the color quantization of the G plane, (d) the clusters data from the color quantization of the B plane. 211
Figure 8. Simulation results-6: (a1)-(a5) the frames 261, 266, 300, 350, 408 of the original sequence, (b1)-(b5) the extracted static backgrounds corresponding to the (a1)-(a5), respectively, (c1)-(c5) the extracted dynamic background corresponding to the (a1)-(a5), respectively. (a) (b) (c) (d) Figure 9. Background generation; (a) one of frames of the original video sequence, (b) the clusters data from the color quantization of the R plane, (c) the clusters data from the color quantization of the G plane, (d) the clusters data from the color quantization of the B plane. Figure 10. Simulation results-7: (a1)-(a5) the frames 392, 395, 399, 429, 810 of the original sequence, (b1)-(b5) the extracted static backgrounds corresponding to the (a1)-(a5), respectively, (c1)-(c5) the extracted dynamic background corresponding to the (a1)-(a5), respectively 212
Figure 11. Simulation results-8: (a1)-(a5) the frames 1106, 1117, 1130, 1235, 1425 of the original sequence, (b1)-(b5) the extracted static backgrounds corresponding to the (a1)-(a5), respectively, (c1)- (c5) the extracted dynamic background corresponding to the (a1)-(a5), respectively. Figure 12. Simulation results-9: (a1)-(a5) the frames 361, 367, 374, 385, 614 of the original sequence, (b1)-(b5) the extracted static backgrounds corresponding to the (a1)-(a5), respectively, (c1)-(c5) the extracted dynamic background corresponding to the (a1)-(a5), respectively. 213
Figure 13. Simulation results-10: (a) one of frames of the original sequence, (b) the extracted static backgrounds corresponding to the (a), (c) the extracted dynamic background corresponding to the (a), (d) the ground truth image, (e) the detected objects image. 4. Conclusion In this paper we calculate the pixels vibration and statistics for the 32 clusters to develop an effective background generation method in color video sequences. We use a color quantization technique to shrink the pixel value from 256 into 32 grayscales firstly. Since the background includes the dynamic background in a video sequence. Therefore, we use a statistic method to develop a background extraction method to separate static and dynamic backgrounds. In fact, we measure the probability of pixels (BP) and judge if it belongs to the static background or the dynamic background. If the BP is less than a threshold SP we process, it is the static background. Otherwise it is the dynamic background. Finally, by adding the static background and dynamic background, the background is completely generated. From the simulation results, it demonstrates that our scheme is an effective and correct method for object extraction in the video sequence. Acknowledgments This work was partly supported by the National Science Council, Taiwan (R.O.C.) under contract NSC 100-2221-E-167-032. 5. Referencers [1] Olivier Barnich, and Marc Van Droogenbroeck, ViBe: A Universal Background Subtraction Algorithm for Video Sequences, IEEE Trans. Image Process, Vol. 20, No. 6, pp. 1709-1724, June 2011. [2] Lucia Maddalena, and Alfredo Petrosino, A Self-Organizing Approach to Background Subtraction for Visual Surveillance Applications, IEEE Trans. Image Processing, Vol. 17, No. 7, pp. 1168-1177, July 2008. [3] Pierre-Marc Jodoin, Max Mignotte, and Janusz Konrad, Statistical Background Subtraction Using Spatial Cues, IEEE Trans. Circuits and Systems for Video Technology, Vol. 17, No. 12, pp. 1758-1763, December 2007. [4] Chung-Cheng Chiu, Min-Yu Ku, and Li-Wey Liang, A Robust Object Segmentation System Using a Probability-Based Background Extraction Algorithm, IEEE Trans. Circuits and Systems for Video Technology., Vol. 20, No. 4, pp. 518-528, April 2010. [5] Jun Kong, Ying Zheng, Yinghua Lu, and Baoxue Zhang, A Novel Background Extraction and Updating Algorithm for Vehicle Detectionand Tracking, Fourth International Conference on Fuzzy Systems and Knowledge Discovery, 2007. FSKD 2007, Vol. 3, pp. 464-468, Aug. 2007. 214
[6] Chengjun Jin, Guiran Chang, Wei Cheng, and Huiyan Jiang, Background extraction and update method based on histogram in YCbCr color space, 2011 International Conference on E - Business and E -Government (ICEE),, pp. 1 4, May 2011. [7] Anh-Nga Lai, Hyosun Yoon, and Gueesang Lee, Robust Background Extraction Scheme Using Histogram-wise for Real-time Tracking in Urban Traffic Video, Conference on Computer and Information Technology, 2008. CIT 2008. 8th IEEE International, pp. 845-850, July 2008. [8], Chin-Ho Chung, "Rock Paper and Scissors Image Identification Scheme by using an Angular Criteria Technique", Advances in Information Sciences and Service Sciences (AISS), Vol. 3, No. 3, pp. 47-55, April 2011. [9] Zunbing Sheng, and Xianyu Cui, An Adaptive Learning Rate GMM for Background Extraction, Conference on Computer Science and Software Engineering, 2008 International., Vol. 6, pp. 174-176, Dec. 2008. [10] Horng-Horng Lin, Tyng-Luh Liu, and Jen-Hui Chuang, Learning a Scene Background Model via Classification, IEEE Trans. Signal Processing, Vol. 57, No. 5, MAY 2009, pp. 1641-1654. [11], Chiou-Kou Tung, " Virtual 3D-Game Control Using Incline Paper Image Detection ", International Journal of Advancements in computing Technology (IJACT), Vol. 3, No. 3, pp. 95-103, April 2011. 215