Implementation of Dynamic Threshold Method for Human Motion Detection in Video surveillance application

Detection of moving objects in video streams is the first relevant step of information extraction in many computer vision applications. Aside from the intrinsic usefulness of being able to segment video streams into moving and background components, detecting moving objects provides a focus of attention for recognition, classification, and activity analysis, making these later steps more efficient. This paper implemented a method to detect moving object based on background subtraction. First of all, we establish a reliable background updating model based on statistical and use a dynamic optimization threshold method to obtain a more complete moving object. The moving human bodies are accurately and reliably detected. The experiment results show that the proposed method runs quickly, accurately and fits for the real-time detection.


I. INTRODUCTION
Surveillance is the monitoring of behavior. Systems surveillance is the process of monitoring the behavior of people, objects or processes within systems for conformity to expected or desired norms in trusted systems for security or social control [1]. The word surveillance is commonly used to describe observation from a distance by means of electronic equipment or other technological means.

Fig. 1 Example of CCTV camera
At a basic level, computers are a surveillance target because large amounts of personal information are stored on them. Anyone who can access or remove a computer can retrieve information. If someone is able to install software on a computer system, they can turn the computer into a surveillance device. CCTV is a collection of video cameras used for video surveillance. CCTV is generally used in areas where there is an increased need for security, such as banks, airports and town centers. A basic CCTV system comprises of the Camera, lens and power supply. Recording device, VCR or a digital video recorder and monitor. Closed-circuit television (CCTV) is the use of video cameras to transmit a signal to a specific place, on a limited set of monitors. The main tasks in visual surveillance systems include motion detection, object classification, tracking. Our focus here is on the detection phase of a general visual surveillance system using static cameras. The detection of moving objects in video streams is the first relevant step of information extraction in many computer vision applications. Aside from the intrinsic usefulness of being able to segment video streams into foreground and background components, detecting moving objects provides a focus of attention for recognition, classification, and activity analysis, making these later steps more efficient, since only moving pixels need be considered [2].The usual approach to moving object detection is through background subtraction, that consists in maintaining an up-to date model of the background and detecting moving objects as those that deviate from such a model. Compared to other approaches, such as optical flow [3], this approach is computationally affordable for real-time applications.The background image is not fixed but must adapt to: Illumination changes, sudden (such as clouds) ,Motion changes ,camera oscillations, highfrequencies background objects (such as tree branches, sea waves, and similar) Changes in the background geometry.

II. BACKGROUND SUBTRACTION
Identifying moving objects from a video sequence is a fundamental and critical task in many computer-vision applications. A common approach is to perform background subtraction, which identifies moving objects from the portion of a video frame that differs significantly from a background model. There are many challenges in developing a good background subtraction algorithm. First, it must be robust against changes in illumination. Second, it should avoid detecting nonstationary background objects such as moving leaves, rain, snow, and shadows cast by moving objects [4]. Some of the well-known issues in background maintenance that will be specifically addressed in the sequel include:  Light changes: The background model should adapt to gradual illumination changes.  Moving background: The background model should include changing background that is not of interest for visual surveillance, such as waving trees.  Cast shadows: The background model should include the shadow cast by moving objects that apparently behaves itself moving, in order to have a more accurate detection of the moving objects shape.  Bootstrapping: The background model should be properly set up even in the absence of a complete and static (free of moving objects) training set at the beginning of the sequence.  Camouflage: Moving objects should be detected even if their chromatic features are similar to those of the background model.  This paper implemented a reliable background updating model based on statistical and use a dynamic optimization threshold method to obtain a more complete moving object.

III. PROPOSED WORK IMPLEMENTATION
In this work the aim is to build such a surveillance system, which can detect motion even if the moving background, gradual illumination variations and camouflage and shadow into the background, thus achieves robust detection for different types of videos taken with stationary cameras. To fulfill this aim, strong computing software called Mat lab is used. Mat lab provides image Acquisition and Image Processing Toolboxes which facilitate us in creating a good code.

Frame Separation
Frame processing is the first step in the background subtraction algorithm, the purpose of this step is to prepare the modified video frames by removing noise and unwanted object's in the frame in order to increase the amount of information gained from the frame and the sensitivity of the algorithm. Preprocessing is a process of collecting simple image processing tasks that change the raw input video info a format. This can be processed by subsequent steps. Preprocessing of the video is necessary to improve the detection of moving object's For example, by spatial and temporal smoothing, snow as moving leaves on a tree, can be removed by morphological processing of the frames after the identification of the moving object's as shown in figure.

Fig. 2: Pre processing of input video frames
Another key issue in pre processing is the data format used by the particular background subtraction algorithm. Most of the algorithm handles luminance intensity, which is one scalar value per each pixel, however, color image, in either RGB or HSV color space, is becoming more popular in the background subtraction algorithms.

IV. BACKGROUND MODELING AND UPDATE
The basic scheme of background subtraction is to subtract the image from a reference image that models the background scene. Typically, the Background modeling constructs a reference image representing the background. Threshold selection determines appropriate threshold values used in the subtraction operation to obtain a desired detection rate. Subtraction operation or pixel classification classifies the type of a given pixel, i.e., the pixel is the part of background (including ordinary background and shaded background), or it is a moving object [5]. J u n e 29, 2 0 1 4

Background Modeling
In the background training process, the reference background image and some parameters associated with normalization are computed over a number of static background frames. The background is modeled statistically on a pixel by pixel basis. A pixel is modeled by a 4-tuple < Ei; si; ai; bi > where Ei is the expected color value, si is the standard deviation of color value which is defined in ai is the variation of the brightness distortion, and bi is the variation of the chromaticity distortion of the ith pixel. Ei, ai and bi are defined explicitly later in this section. The expected color value of pixel i is given by Where , and are the arithmetic means of the ith pixel's red, green, blue values computed over N background frames. So far, we have defined Ei and si. We also discussed about balancing color bands by rescaling the color values by the pixel variation factors (si). Thus the brightness distortion and the chromaticity.

Background Update
For the background model can better adapt to light changes, the background needs to be updated in real time, so as to accurately extract the moving object. In this paper, the update algorithm is as follows: In detection of the moving object, the pixels judged as belonging to the moving object maintain the original background gray values, not be updated. For the pixels which are judged to be the background, we update the background model according to following rules: Where f3 E (0,1) is update coefficient, m this paper f3 = 0.004 . Fk(x,y) is the pixel gray value in the current frame. Bk(x,y) and Bk+1(x,y) are respectively the Background value of the current frame and the next frame. As the camera is fixed, the background model can remain relatively stable in the long period of time. Using this method can effectively avoid the unexpected phenomenon of the Background, such as the sudden appearance of something in the background which is not included in the original background. Moreover by the update of pixel gray value of the background, the impact brought by light, weather and other changes in the external environment can be effectively adapted.

Moving Object Extraction
After the background image B(x, y) is obtained, subtract the background Image B(x,y) from the current frame Fk (x, y). If the pixel difference is greater than the set threshold T, then determines that the pixels appear in the moving object, otherwise, as the background pixels. The moving object can be detected after threshold operation. Its expression is as follows: Where Dk (x, y) is the binary image of differential results. T is gray-scale threshold; its size determines the accuracy of object identification. As in the algorithm T is a fixed value, only for an ideal situation, is not suitable for complex environment with lighting changes. Therefore, this paper implemented the dynamic threshold method, we dynamically changes the threshold value according to the lighting changes of the two images obtained. On this basis, add a dynamic threshold!'1T to the above algorithm. Its mathematical expression is as follows: Where A is the inhibitory coefficient, set it to a value according to the requirements of practical applications, and the reference values is 2. M x N is the size of each image to deal with. M x N numerical results indicate the number of pixels in detection region. This method can effectively suppress the impact of light changes ( [6], [7], [8]). J u n e 29, 2 0 1 4

V. RESUL AND DISCUSSION
Several points for moving object detection using the given approach have been produced for input image .

Fig.4: Output video (Moving Person is perfectly detected)
Values for the distance thresholds should be chosen such that High values for allow to limit selectivity in the update of the background model during the calibration phase, enabling the inclusion into the initial background model of several observed pixel intensity variations. Lower values for should be chosen to obtain a more accurate background model in the online phase by applying the detection mask, we can observe that the object is almost perfectly detected, despite his camouflage and moving background.

VI.CONCLUSION AND ONGOING WORK
In this paper, a real-time and accurate new method for detecting moving human body is implemented based on background subtraction. In cognizance of the shortcomings and deficiencies in the traditional method of object detection, we establish reliable background model, use dynamic threshold method to detect moving object and update the background in real time. Experiments show that the algorithm is fast and simple, able to detect moving human body better and it has a broad applicability.