Adaptive Threshold for Background Subtraction in Moving Object Detection using Stationary Wavelet Transforms 2

Both detection and tracking objects are challenging problems because of the type of the objects and even their presence in the scene. Generally, object detection is a prerequisite for target tracking, and tracking has no effect on object detection. In this paper, we propose an algorithm to detect and track moving objects automatically of a video sequence analysis, taken with a fixed camera. In the detection steps we perform a background subtraction algorithm, the obtained results are decomposed using discrete stationary wavelet transform 2D and the coefficients are thresholded using Birge-Massart strategy. The tracking step is based on the classical Kalman filter algorithm. This later uses the Kalman filter as many as the number of the moving objects in the image frame. The tests evaluation proved the efficiency of our algorithm for motion detection using adaptive threshold. The comparison results show that the proposed algorithm gives a better performance of detection and tracking than the other methods. Keywords—moving object detection; SWT; background subtraction; adaptive threshold; kalman filter


INTRODUCTION
It is easy for a human being to recognize images or other objects around him, but it is a very complex problem for an automated system.Nevertheless, many systems need to have information on the presence or the absence of objects in their environment.In other terms, object detection and tracking in a video sequences have been one of many important problems in computer vision and have attracted more and more researchers working on it.Furthermore, moving object detection has been used for many computer vision applications, including recognition of traffic scenarios [1], supervision traffic flow [2], collision prediction of pedestrians [3], face detection [4], human-machine interaction [5], etc.While detecting and tracking, we need to analyze video sequences to detect and track target in each frame, to achieve monitoring and to master the dynamic variation of the moving objects in order to confirm their exact position.In general, there are lots of methods which can be classified into three categories: optical flow [15,37], [16], temporal difference [13], [14] and background subtraction.The algorithms of temporal difference quickly adapt to sudden changes in the environment, but the resulting shapes of target are frequently incomplete.In general, optical flow methods present the projected motion on the image plane to high approximation based on the feature of flow vectors.Unfortunately, flow vectors of moving objects only indicate streams of moving objects, thus detecting a sparse form of object regions.Moreover, the computational complexity of optical flow methods is usually too high to easily implement the motion task in the general video surveillance system.Usually, background subtraction is the operation that logically follows the background modeling to obtain a motion detection.If the background model is an image, an absolute difference between this model and each incoming video frame is performed to obtain motion detection.When there is a statistical model, we calculate the probability that each pixel belong to the background by testing the value observed in the model, the importance of the observed movement varies in the opposite direction to the calculated probability.
Many algorithms have been proposed for the moving objects detection.Yumiba et al. [10] proposed an algorithm called ST-Patch for motion detection to cover dynamic changes in background.Authors in [30] proposed a method to evaluate the quality of stereoscopic images that are afflicted by symmetric distortions.Edward J. Delp andKa Ki Ng [11] invented an approach to calculate the threshold automatically and dynamically relating to the pixels' intensities in the present frame and a method to update the background model based on learning the rate relating to the differences between the background model and the last image.Elham Kermani and Davud Asemani [12] proposed new method based on adaptive structure firstly detects the edges of motion objects, then, Bayesian algorithm corrects the shape of detected objects.
Many studies have been used subband adaptive thresholding for denoising image using discrete wavelet transform (DWT) [13,14].For us, our contribution consists to integrated this technique in video sequences to detect moving objects with stationary wavelet transforms 2D.According to the difficulty of motion detection in video surveillance, the most used techniques deal with a fixed camera [15,16] or closed world representations [17] which rely on a fixed background or a specific knowledge on the type of actions taking place, where various difficult cases are not perfectly www.ijacsa.thesai.orgsolved and must be improved such as identification, occlusion, tracking of object, localization and removing shadows of objects.
In this paper, we have developed a novel approach for motion detection based on discrete stationary wavelet transform.The rest of this paper is organized as follow.In Section 2, the adaptive background subtraction algorithm detects all the moving objects to get the whole moving area.In this step, the different objects obtained by calculating the result of the difference between the background frame and the present frame image, and then thresholding by discrete stationary wavelet transforms SWT [18].In Section 3, once a target is detected the tracking phase starts.Therefore, we adopt the Kalman filter for more effective monitoring of targets.Section 4, experimental results and some discussion are presented.Finally, Section 5 concludes this paper with a discussion and the imagination of our future work.
This figure shows the flowchart of the background subtraction.

II. PROPOSED ADAPTIVE THRESHOLD USING SWT FOR DETECTION OF MOVING OBJECTS
In this section, an adaptive threshold technique based on SWT is applied on the obtained image using background subtraction, to detect moving objects of each frame in a video scene.For better follow up the concept of proposed algorithm, the basic idea of detection using background subtraction is firstly described.Then, it will be combined with the stationary wavelet SWT.As a result, an integrated background subtraction-SWT algorithm is obtained for optimally detecting moving objects.
Motion detection methods are basically a process which detects the object in the surveillance area [19].The following diagram summarizes the proposed algorithm for motion detection with background subtraction based on an adaptive threshold.The following figure 4 involves a number of different steps, each of them are discussed below:

A. Background frame initialization
For video analysis, the background initialization is highly important after the pre-processing is done on each frame.When the background image is initialized it will be presented as the reference image.There are many techniques to obtain the initial background frame.For example, calculate the background image by averaging the first images, or take the first frame as the background directly or using a background image sequences without the prospect of moving objects to estimate the background model parameters.
In this part, we consider that the video begins with the background in the absence of moving objects.We use the selective averaging method [21] to obtain the initial background model as: Where ( )and ( ) are respectively the intensity of pixel of the background model and the intensity of pixel of the frame, and is the number of frames used to construct the background model.

B. Background subtraction
After obtaining the initial background model, the subtraction between the current frame and the reference frame is done for the moving object detected.The subtraction will be done pixel by pixel of the both frames.The simple version of this scheme, where a pixel at location in the current frame , is indicated as foreground if: is The background image is the adaptive threshold calculated by stationary wavelet.
The Background subtraction is used to recognize the pixel intensity of foreground which is obtained by the difference between the current image and the background image.Let consider that is the binary foreground of an image.
Where represents the interval time between the current frame and the old one.The threshold adaptive δ that classifies between foreground and background can be determined by our proposed algorithm using stationary wavelet.

C. Image Analysis using wavelet stationary
In this subsection, the thresholding step is based on stationary wavelet transform.First, the foreground result is decomposed into different sub-bands using SWT.Then, the obtained coefficients are thresholded.These sub-bands are shown in the table below: H and L present respectively the low and the high-pass filters.The LL sub-band is the low resolution residual composed of low frequency elements and this sub-band which is further split at higher levels of decomposition.After decomposition, the obtained coefficients in the detailed subbands are thresholded to reduce the noise and also the thresholded frame is reconstructed from the thresholded subbands [22], [23].The steps of wavelet thresholding are described as follows: i.
Decompose the frame exploiting SWT.ii.Threshold the coefficients of wavelet exploiting the chosen threshold algorithm.
iii.Reconstruct the frame exploiting ISWT for the threshold frame.

1) Universal threshold
The universal threshold (Visu Shrink)  has been proposed by Donoho [24].It is described as: Where N is the number of the wavelet coefficients and  is the noise variance in that frame which is computed from the diagonal sub-band ( ) as: 2

) Proposed adaptive threshold
The universal threshold exploits a threshold value that is directly depends on the standard deviation of the interfering signal and tracks the hard threshold rule.It is changed exploiting weighted median and golden ratio.Fig. 3 depicts the block diagram of the suggested algorithm.5), we use the weighted median to calculate the median value of the high pass party of the frame.This method opts the classical weight function (W) [25] for calculating the weighted coefficient of the diagonal sub-band (HH) which is given by the following: Here's is the coordinate of the HH sub-band.The diagonal sub-band HH will be multiplied with the weight W to get the weighted diagonal sub-ban HH1.The hard threshold eliminates coefficients underneath a threshold value ( ) that is obtained by the proposed algorithm of thresholding.
The last equation describes the segmentation after the differentiation of the present and the background frame.That subtracted image obtains the subtracted value of each pixel, that pixel value is compared with the threshold value.If the subtracted pixel value is greater than the threshold value so, it will take 1 else it will take 0.
The value of 1 presents the black color and the value of 0 presents the white color.So the segmented image obtains the moving target in white with a black background, as result, the moving object is detected.

D. Background update
Now, we present a short introduction to the background update approach suggested by authors in [26] that is based on a dynamic matrix.First, a dynamic matrix D(k) is analyzed in order to have a decision whether this pixel appertains to the foreground or not.Supposing that I (k) is the input image at time k that is the index for the pixel position I_s (k).The expression (4) of the dynamic matrix D(k) at time k is given by: Where λ presents the time length to record the pixel's moving state.When D_s (k) corresponds to zero, the pixel will be updated into the background with a linear model.
is the background frame at time k and is the weight of input image.

III. OBJECT TRACKING USING KALMAN FILTER
The Kalman filter is usually applied in investigations of dynamic systems, prediction, analysis, processing and control.Kalman filter is an optimal filter for the discrete data linear filtering issue.It's an ensemble of equations that offers a good solution to sequential systems.As such, two equations describe the kalman filter which are: the time update equations and the measurement update equations.Time update equations, from time step K to step K1, are in charge of projecting forward the current step and error covariance predicts to get the priori predictions for the upcoming time state.The measurement update equations are accountable for the feedback that means to incorporate a novel measurement into a priori estimation to get better posteriori estimation.
The time update equations can be also acounted as predictive equations and the measurement update equations as corrector equations.Indeed the final prediction algorithm looks like an estimator-corrector algorithm that giving solutions for numerical problems as presented below in Fig. 5. Where, P is the estimation error covariance.Q presents the process noise covariance, R depicts the measurement error covariance and K presents the Kalman gain.We assume a discrete-time linear system state equation and an observation model, as follow: The state equation and measurement model are: Where A, B and H are the model matrices.k and k v depict respectively the process and the measurement noise.
In this paper, the state vector is defined as , , , In the following, A is the transition matrix and H is the measurement one of our tracking systems with the Gaussian process k w and measurement k v .These noise values are entirely dependent on the system that is being tracked and adjusted experimentally.

IV. EXPERIMENTAL RESULTS
At present, many motion detection approaches have been developed that execute well in some types of videos but not in others.There is a list of challenging problems in the video surveillance applications addressed including shadows, repeated motions of background and illumination changes.To show the ability of the proposed algorithm to handle key challenges of real-world videos, it has been applied to several sequences with different frame rates and detection challenges.In order to better understand the performance of the algorithm, we use seven real video sequences, which are "traffic" "campus" "intelligent room" "hall monitor" "laboratory" "people" and "traffic2", to test each method by results simulation and qualitative evaluation.Concerning each motion detection challenge, one or more videos have been selected.

A. Simulation results
This part presents the experimental result comparison between our algorithm for moving objects and other motion detection methods, including the Mixture of Gaussian algorithm MOG [27] and multiple Σ−Δ estimation MDE method [28].The first comparison is made with MOG being a widely exploited adaptive background subtraction algorithm.It has good performance for the stationary and the nonstationary backgrounds.The second compared algorithm is the robust method of (MDE) being done by estimating the static background.Detection results have been compared for the case where competitor methods exhibit the best possible performance as the results of other methods have been collected from [27,28] (figures 7, 8 and 9 of [27,28] and figure 6 of method exploiting fixed threshold).
The figure 6 describes the obtained results of "video sequences people" by applying an adaptive thresholding based on SWT techniques.Where 6.a' depicts the original frames and 6.b' stands for detection results of our algorithm.6.c' and 6.d' are the detection results of foreground while the threshold value is set at 33 and 80.In this video, it may be observed that the approach exploited set thresholds fails to generate good results in the presence of diverse frames, for a high threshold value, noise positions will be wrongfully detected as foreground objects.It may be seen that our algorithm can detect and separate the moving objects of walking persons almost perfectly.In Fig. 8(a'), a set surveillance camera takes a scene with different vehicles from one direction.As presented in Fig. 8(c'), the MOG algorithm exploits many Gaussian kernels to produce a mixture background model, thus producing the motion challenging problems.Compared with the MOG, the MDE algorithm also produces a mixture background model by constant sign computation.Moreover, constant sign computation is also applied to compute the threshold parameter in terms of motion detection.Regrettably, the threshold value is still changed when the novel pixel presents the background, thus detecting the false object pixels, as presented in Fig. 8(d').The suggested algorithm detects the moving object by comparing the background values and the foreground values that are computed by adaptive threshold using SWT.Hence, noise artifacts with sudden illumination changes caused on off lights are reduced in the detection results described in Fig. 8(b').The table.2 shows the comparison of performance between the suggested method and the algorithm using different fixed  Table 3 shows the average f_measure rate of each algorithm for ''Hall monitor, intelligent room'' test scenes.As a result, the suggested algorithm attains the biggest f_measure values compared to other mentioned methods.In particular, we can easily show that the proposed method attains better accuracy rates of all metrics than 85% concerned to motion detection.

V. CONCLUSION
This paper used a background subtraction to detect the objects moving through an adaptive threshold technique based on SWT in order to improve our algorithm to detect and track the moving targets.The suggested algorithm does not only outperform the drawbacks of high complex calculation and slow speed for the background subtraction, but also preserves the wavelet characteristics of the flexible multi-resolution image and the capacity for processing with noises and wrong motion such as moving leaves of trees.Compared to other algorithms, the experimental results prove that the proposed approach can detect and track the moving objects efficiently and with robustness.Moreover, the simplicity of the proposed method indicates that the approach can be implemented in different intelligent systems.

Fig. 2 .
Fig. 2. Block diagram of the proposed algorithm To predict the noise level σ, authors in [29] proved that the Median Absolute Deviation is presented as: MAD(X) = |X-Median(X)| converges to 0.6745 times σ as the sample size.

Fig. 3 .
Fig. 3. Block diagram of the suggested algorithm In this part, replacing the value '2' with the golden ratio value '1.68' is suggested to use and the threshold  is computed as:

1 (
noise variance σ is then determined from the weighted diagonal sub-band (HH1) as follow:(HH) / 0.6745 Median  (9) After calculating the noise variance, the modified universal threshold is applied to the frame and the process is treated in the suggested algorithm.

Fig. 4 .
Fig. 4. Algorithm describing thresholding method of modified universal threshold exploiting weighted median and golden ratio

Fig. 5 .
Fig. 5.The whole operation of the Kalmanfilte the horizontal and vertical centroid coordinate, ( , kk lh ) depict half-width and half-height of the tracking window, www.ijacsa.thesai.org

Fig. 6 .Fig. 7 .
Fig. 6.Detection results of proposed algorithm compared with the method using fixed threshold In Fig. 7(a), a man is walking in a room.Some system noises are present in this video sequence due to the low quality of the camera.As presented in Fig 7(c) and 7(d), both MOG and MDE methods produce serious noise by the noisy systems.Our approach applies after subtracting the background frame and the current frame image, an adaptive threshold using stationary wavelet transforms 2D to compute the characteristic for the probabilities of the background and the foreground.Therefore, the proposed algorithm can detect the moving objects and remove the shadows of walking persons, as shown in Fig.7(b).97-thframe165-th frame 248-th frame 300-th frame

Fig. 8 .Fig. 9 .
Fig. 8. Detection results of the suggested algorithm compared with sequence with varying illumination

Fig. 10 .
Fig. 10.Tracking results of the traffic video Figure 10 presents the tracking results for a video traffic of moving cars in an indoor sequence.The experiments affected the tracking of moving object exploiting the adaptive background subtraction based on stationary wavelet transforms and Kalman filtering.The moving target may be detected and tracked effectively with our algorithm at frames 98 and 15.Row 1 is the detection results and row 2 is the tracking results.

TABLE I .
DECOMPOSITION OF FRAMEINTO FOUR SUB-BANDSB EXPLOITING SWT

TABLE II .
THE RESULTS OF OBJECTS DETECTION AND TRACKING To evaluate the effectiveness of the suggested algorithm, we exploited the parameters (precession and recall) for compare the proposed method to the other algorithms the parameters are defined as follows:Where Tp is total number of true positive pixels, Fn presents the number of false negative pixels, Fp presents the number of false positive pixels.The Table1describes the results of accuracy values for Traffic sequence.