Target Detection Algorithm Based on the Movement of Codebook Model

Movement target detection is the researchful emphasis and aporia in the fields of computer vision, model recognition and video coding. In order to extract moving targets from the complex background scenes, this paper puts forward to calculate the color distortion degree by means of getting every pixel or a group of pixels of time series model, and converting pixels from RGB space to HSV space. Based on the background Codebook model of the target motion detection algorithm, the experiment shows that the method can achieve better target detection quality.


Introduction
With the development of computer technology, using computer to realize the human visual function through a computer has become one of the most popular subjects in computer field.One important aspect of computer vision research is motion target detection.It can be widely applied in the fields of intelligent video monitoring, human-computer interaction, virtual reality, robot navigation, traffic detection and many other areas.Light flow method (McKenna Setal et al., 2000) is rarely used because of the computational complexity, and frame differential method can deal with the slow background change.However, the detected objects easily appear so rupture and empty that the complete motion target is hard to get.Therefore, people tend to use the method of reducing background more and more.
At present, the problem on moving target detection has not been solved completely in complex environment.This is mainly because the background changes happen at any time whether indoors or outdoors including illumination change, background disturbance and the background change caused by the motion target itself, etc.Meanwhile, there are some shortcomings of the present algorithm in background renewal speed, threshold selection flexibility, memory storage and accuracy.For example, finite difference method (C.Bregler, 1997) and mean filter method (C. Wren et al., 1997) call for large storage space and have poor adaptive ability.And the unimodal distribution model (D. Koller et al., 1993) cannot model the background of the shaking tree branches.Although gaussian mixture model can be applied in background modeling with complex or dynamic background noise(such as the background raindrops and the shaking tree branches), it is difficult to use several limited gaussian model to describe the rapidly changing background accurately.And it is hard to keep the learning efficacy of gaussian mixture model in an ideal state.
Based on the above reasons, this paper proposes the future inspection method on the basis of Codebook finite difference method, which compares the color distortion by converting pixels from RGB space to HSV (hue, saturation, value) space.And through HSV color sampling study on three axis, every pixel can get a code book.According to the distribution characteristics of the prospects and background points in the image point, the background code words are separated and can be used for background modeling.The results show that although the conversion to HSV color model introduces floating point arithmetic which makes the processing speed slower compared to the method of Kim (Kim K et al., 2004), more accurate detection effect can be obtained that the foreground objects of the complex background can be detected successfully.

Codebook Background Model
Codebook model algorithm is to obtain each pixel yards based on the color standard and brightness boundaries clustering, by means of using quantitative and clustering techniques to build background model and training each pixel.Each pixel has a different codebook, each codebook contains several code words, and all the pixels of codebook make up the codebook model.
is the sequence sample value of a pixel, among which t is the codebook of this pixel, each code word i x (i=1,…, L ) is defined as binary group structure and  can show the maximum time interval of the code words.Besides, p and q can be used to show the matching time of the first and last time after its appearance which can be set as a simple frame.
In the process of training the initial Codebook, Let X is defined as a single pixel consisting of N RGB-vectors: . Every sample value t x represents the sample at the moment of t.It can be compared to the present yard so as to determine which yard m c can be matched with.Then the matching yard is used as code estimate of the sample.In order to ascertain the best match of the yard, the color distortion and brightness are used as the reference for the measure boundary.When pixel sample values surpass the existing Codebook border, new Codebook entry is created.And when the pixel value is in the existing border area, the code sample border will increase.However, if a pixel is beyond the boundary distance of the code sample, a new code entry is created and a high or low threshold is set.And every code entry is examined to check whether pixel is in the code border.Besides, if this pixel value is within the border, the maximum and minimum threshold is adjusted to make sure it is included in the code border.Meanwhile, the last updated time is set as the current time and the statistics access frequency of each code item is estimated.In addition, when the code cannot be assessed for a long time, it may be due to the noise or moving prospect target.As time goes on, it becomes an old code.Therefore, it is necessary to update the needed entry codebook and delete the unwanted entry code.The main steps of the algorithm (A.Elgammal et al., 2000) are described as: to match the sample t x to satisfy: brightness boundary color distance Ⅳ. Using  to eliminate redundant code words, the accurate and initial codebook with the representative background is found out M (K is the index of code word): Steps in the algorithm, 1  is global threshold variable which must make suitable adjustment for the application.
Threshold M T usually take half the number of frames, namely 2 / N all the code words with the representative background must appear within the frame.Among these, the 2 conditions of stepⅡ are that the colors of t x and m c are very similar and that the brightness of t x must be within the acceptable brightness of m c .Here it is necessary to find the code word that makes the first condition satisfy the second condition.The reason of introducing time rule  is that redundant codes are obtained in the process of training among which some represent the prospect moving target and noisy code words.Using step Ⅳ can separate these code words in probability sense which allows the existence of moving target in the initial training process.

Determining the Scope of Color Distortion Degree and Brightness Degree
In order to deal with the illumination changes of shadows and highlights, RGB model is often used.But it is bad for the color effect of the dark areas because the pixel differences in the dark areas have higher stability than that in the bright areas.For example, L and D represent the two dark pixels and a lighter pixel, then their color distortion degree (CDD) is calculated respectively as shown in Table 1.
From Table 1 we can see that the color change is larger in low light than that in high light.Thus high brightness of the detection sensitivity will be sacrificed.
Theoretically, RGB color space has bigger differences than eye perception, while HSV color space is consistent with human eye perception characteristics and it has been widely used in the video image retrieval.Through HSV color space, human eyes can have the separate perception of the color change.And the perceived color difference is proportional to the amount of Euclid distance.Therefore this paper will calculate the color distortion degree by converting pixels from RGB space to HSV space, so as to judge the changes between prospect pixel and background pixel (Greiffenhagen M. et al., 2000) agilely.
Suppose a function RGB2HSV ( ) which is converted pixel RGB value to HSV value, h, s, v are three vectors in HSV color model,


(5) In order to define dark and highlight areas, it is necessary to define the brightness change range of the moving target.And for each code word, its scope is defined as   hi low I I , , the smaller  is, the greater the brightness range is. 5 .
, the range of the code is stable in the process of updating.Brightness function is defined as

The Prospect of Movement Target Detection Based on Codebook
For detection technology to reduce background motion, the most direct method is to subtract the current frame from the background model.This paper will judge whether pixel sampling value matches with the corresponding code.If they match, the point is taken as the background point.Otherwise, it is taken as the prospect point.For the new input pixel and the corresponding code M in the process of movement target detection, reducing background operation algorithm ) (x BGS is shown in Figure 1.

Updating the Background Model in the Testing Process
In order to be suitable for the real-time accuracy of the video monitoring system, updating the code is necessary in the process of target detection.Much attention should be paid to illumination change and moving target itself (such as stop or traffic) caused by the changes of the background model updating.And it includes two parts, namely the background areas and the coverage areas of the frame object.If the sample value of a pixel cannot match with the present code M , a new code word will be created.
First, updating the background pixel and finding the new input pixel At the same time, a frame for moving objects coverage area is considered.The updating method will incorporate it into the background model at high updating rate and update the matched code words m c , m u and

Analyzing Experimental Results
In order to evaluate the proposed algorithm, Visual C++6.0 and open source machine vision library OpenCV1.0 are used.And in order to detect the prospect target, a series of videos realize the background modeling and background model is regularly updated.Moreover, the results show that as to outdoor video, every pixel needs an average six yards to get background model, while indoor video just needs one or two background value.This algorithm needs to be trained once and the repeated training cannot enhance the detection ability.And the time standards  can be used to distinguish the code words having real background from the moving foreground code words.And it makes no difference between considering the frequency f and  of the code words and only considering the inspection ability of  .The experimental results are obtained after the simple morphology processing by using the algorithm for a group of indoor and outdoor videos.They are shown as Figure 2 and Figure 3. Parameter settings in the experimental process are shown in Table 2.
In Table 2, 1  , 2  are threshold variables and  ,  are brightness coefficients, N is for training the frame number.In the process of background modeling, the existence of the moving target cannot be allowed to store the previous pixel numerical value, so the small memory is needed.From above we can see that because the brightness and color difference are considered in the method of this paper, the dark and highlight areas are dealt with effectively.

Conclusion
In this paper, adaptive background minus algorithm is used to obtain effective background model through simple training which can limit the size of the memory used and can be well adapted to the background movement and light changes.Because the color distortion is compared by converting the pixel from RGB space to HSV space, more accurate target detection effect is achieved than the method of Kim.However, due to the introduction of floating point arithmetic, the algorithm processing speed is becoming slower.Therefore, in the future research, more attention should be paid on the limited strategy of the code size and the ordering strategy of the code words, which can reduce the memory match the time of the codebook and further improve the processing speed.
maximum brightness values of the code words.f can show the frequency of the codebook

Figure 1 .
Figure 1.Flow chart of algorithm