Video Target Detection In Underground Mine Based On Background Difference And Edge Detection

In view of the complex environment in the underground mine, the detection of moving targets in surveillance video often had the problems of low detection efficiency and the detection result was greatly affected by noise and shadows. A target extraction method based on fusion background subtraction, interframe difference and edge detection was proposed. Firstly, the method used the hybrid gaussian background modeling(GMM) to obtain the accurate background image of the dynamic environment, and the extracted moving targets by using background subtractiont. Then based on the three-frame differential and Canny edge detection, the foreground image and the moving object blob was obtained, which was combined with the background subtraction to eliminate noise and voids, and to avoid missed detection of the moving target. Finally, the shadows in the detection process were removed through pixel ratio and threshold screening, and morphological and connected domain processing were performed. Comparing the improved algorithm with the traditional algorithm, the test results show that the improved algorithm can effectively remove the noise and voids, suppress the shadow, avoid the missed detection target, and have a good detection effect.


Introduction
In recent years, with the rapid development of coal mining, the application of underground video surveillance technology in coal mines is becoming more and more mature. But, there are many influencing factors in the underground mine environment, the detection effect of the target in the video surveillance system is not ideal, which will affect the target identification, target tracking and other behaviors in the later period. There, the detection of downhole moving targets has become an important research content.
The commonly used target detection algorithms include the inter-frame difference method [1] , the optical flow method [2][3] , and the background subtraction method [4] , etc. The frame difference method can detect moving targets quickly, but the detected moving targets are mostly contours with holes and double shadows. The optical flow method has high complexity, requires hardware support, and is sensitive to light; the background subtraction operation is fast. The algorithm is simple and easy to implement, but it depends on the establishment of the background model. Grimson and Stauffer [5] proposed a hybrid Gaussian background model, which can follow adaptive changes in the dynamic environment, but there are also flaws in the detection target that is incomplete, sensitive to light mutations and noise in complex situations. Qu Jingjing, Xin Yunhong [6] uses the successive frame difference image to obtain the rough detection of the background, then uses the median filter and the adaptive filter to filter the background separately, and finally the background difference method is used to detect the moving target, obtain an accurate target. Yu Le [7] proposed a background modeling method with excellent performance, which uses mixed Gaussian to establish and update the background model, optimizes through debugging parameters, and use the background subtraction to obtain the foreground. It can meet the realtime requirements, but the amount of calculations increases; Kang Jie, Li Xiaojing [8] proposed method that using the mean background modeling, then add the background to the three-frame difference method for inter-differential methods to solve the cavitation phenomenon, but false detection occurs when the moving target is in a strong light environment. Zhu Guangze [9] proposes a method based on fuzzy theory combined with background subtraction to realize the detection of people under the mine by defining membership function of the target area. Although realtime requirements can be met, the detection effect is not very good when only part of the target is in the video, and false detections are prone to occur. Meng Xiaoyan [10] proposed an improved method for modeling the target of mine personnel using the hybrid Gaussian background modeling. Reducing the amount of computation by dividing the video frames into blocks, the different stage of vector of the improvements makes accuracy has a certain improvement, but there are still cases of misdetection and missed detection targets.
Although background subtraction can detect accurate targets, it is only suitable for the ideal situation in the outside world. In practical applications, it is difficult to have a completely static background image. Once the environment is mutated, the detection effect of background subtraction will decrease. Moreover the establishment of the background model is more sensitive to the changes of the environment. The mixture Gaussian background modeling can adapt to the background changes. So this paper uses a mixture of Gaussian backgrounds to get an accurate background image, and then uses the background subtraction to detect the target and get the foreground image 1. Based on inter-frame difference, the complete target contour can be detected and the foreground image 2 can be obtained. The Canny edge detection, which is not sensitive to noise and light, is used to obtain the foreground image3, and the foreground images is filled to obtain the moving object mass. Finally, the three elements are combined to achieve the effect of removing noise, cavitation and light, and the detection effect is good. The pixel ratio method is adopted and the shadow is removed by comparing with the threshold value.

Gaussian mixture model(GMM)
The Gaussian mixture model is a method based on pixel level background modeling. The main contents include the establishment, updating of the background model and foreground segmentation. The probability density function of each pixel can be represented by the probability density function of K weighted gaussian distribution: Where j x denotes the value of pixel j at time t, represents the gaussain distribution probability density function.
For the update of the background model, proceed an follows: , , (1 ) In the formula, α is the update rate of model weights, and ρ is the parameter learning rate. If the current pixel value matches the background model, , i t M takes a value of 1, and the parameters are updated according to the above formula. Otherwise, the value is 0, only the weight of the model is updated. If the current pixel value does not match with any Gaussian distribution, then the Gaussian distribution with the lowest weight value representing the background process is least likely to be reinitialized. The mean value is the current pixel value, and the larger variance and the smaller weight value are selected.
After the parameters are updated, to determine which Gaussian distributions of the Gaussian mixture model are generated by the background process, arrange the ratio of k k ω Σ from the largest to the smallest, and select the first B Gaussian distributions in the sequence as the background pixel model: Where, T is a predetermined threshold value. If the current pixel satisfies with equation (3), the pixel is a background point, otherwise it is a foreground point.

Edge detection incorporates background subtraction
The inter-frame difference method can detect the complete target contour, but the extracted moving target has voids and isolated points. The Canny edge detection can extract the edge and details of the moving object very well. In this paper, the foreground image detected by the frame difference method uses the Canny operator to extract the edge and fill it into a moving blob, and then the three are combined to eliminate the noise, hollow, making the testing effect better.
The Canny edge operator [11] is a multi-level edge detection algorithm developed by John F. Canny. Specific steps are as follows: 1) Gaussian filter smoothing noise. The following shows a Gaussian function H(x,y), that omits the coefficient: 2) Calculating the gradient amplitude and direction Where, f(x,y) is the image data. The gradient amplitude and direction are obtained: 3) Non-maximum suppression. The maximum point of the local gradient is retained, while the non-maximal values are suppressed, leaving only the candidate edges. 4) According to experience, the ratio of double threshold value of Canny edge detection operator is 3:1. After the edge of the moving target is filled, the filled moving target cluster is shown in Figure 2

Shadow elimination
Because of lighting, shadows of moving objects are often detected as foreground. The shadow generally meets a certain color feature, and the gray value of the pixels in the shadow region is smaller than the gray value of the pixels in the non-shaded region [12][13] , and three-channel threshold filtering can be performed by traversing the pixels.
According to the grey value of the pixels in the shadow region is smaller than the gray value of the pixels in the non-shaded region in this paper, and the gray value of each pixel in the current frame image is divided by the gray value of the corresponding pixel in the background image to obtain a ratio, if the ratio is within a certain range of threshold value, this point is considered as a shadow point.
According to equation (9), the ration of the current frame to the background frame is as follows: double fr x y Rate x y double fg bw x y = Among them, fr (x, y) is the pixel value of any point in the current frame, and fg_bw (x, y) is the value of the pixel corresponding to the background image. The choice of threshold was carried out through continuous experiments. Through multiple experiments, the low threshold was 0.2 and the high threshold was 0.8.

Algorithm implementation process
The algorithm is divided into the following five steps: Step1: Using mixed Gaussian for background modeling to get an accurate background model.
Step2: Using background subtraction to differentiate the current frame image from the background image and segment the motion foreground image 1. The adaptive threshold method is used to segment the differentiated binary image to enhance the detection effect.
Step3: Two-frame difference is replaced by threeframe difference to get the foreground image2. Then the Canny edge detection operator is used to detect the foreground contour, and the morphological processing is performed to fill the moving object into a mass.
Step4: The background subtraction,inter-frame difference and motion blocks detected by edge detection are fused, and the shadows are removed by threshold screening.
Step5: Performing morphological and connected domain processing on the above test results to obtain a moving object with a frame identifier.
The overall flow chart of the algorithm is shown in Figure 2.2:

Test environment and video source
In order to verify the detection results of the algorithm, I selelcted two video images in the mine for verification, namely single-target video images and multi-target video images. The algorithm is compared with three-frame differential, mixed Gaussian background modeling and background subtraction. The size of video image is 352*288,frame rate is 25fps. The experimental platform is windows7, CPU AMD 2.7GHz, and the simulation platform is Matlab2015.

Single target detection and analysis comparison
As shown in Figure 3.1 below, Figure 3.1(a) selects the 330th, 490th, and 525th frames in the sequence of single-target video images. Figure 3.1 (b) shows the results of detection using inter-frame difference. Due to the subtraction of consecutive three frames of images, most of the moving targets are not detected. Figure 3.1 (c) is a foreground image detected using a hybrid Gaussian background model. The target detected by this method is incomplete and there is a lot of noise. Figure 3.1(d) is a moving target extracted by using background subtraction which is relatively complete but noise sensitive. Fig. 3.1(e) is the moving target detected by the algorithm of this paper. Due to the adoption of the three methods of fusion, overcome the shortcoming of each method, the detected moving target is relatively complete, and the processing effects of light and noise are better.

Multi-objective detection and analysis
Experiment 2 is the detection result when the selected underground mine contains multiple moving targets. As shown in Figure 3.2. Figure 3.2(a) is the image of video on frame 180. Because of the complex and diverse environment under the mine, light, shadows, similar moving targets and background will affect the detection results. Fig. 3.2(b) and Fig. 3.2(c) respectively show the detection results of three-frame difference method and mixed gaussian backgroun modeling, Both are sensitive to light and noise. The detection results contain holes and some of the shadows are also detected together. Figure 3.2(d) shows the background difference detection result. Compared with the former two, the detection effect is much better. Fig. 3.2(e) is the detection algorithm of this paper. The detection algorithm in this paper has a good inhibitory effect on noise and shadow, and the extraction of the moving target is more complete. As shown in figure 3.3 that after the motion foreground is extracted from the multi-target video image, the connected domain object is used to identify the moving object with a box, and the Gaussian mixture background model, background difference and the algorithm are used to compare the detection results of the connected component. Fig. 3.3(a) shows the original image of the 125th frame of the multi-target video, Fig. 3.3(b) uses the hybrid Gaussian background modeling method to detect the result after the connected-domain processing. Due to the use of mixed Gaussian background modeling, shadows have larger weights and smaller variances, so the shadows are detected as the foreground together. Fig.  3.3(c) is a foreground image detected by using background subtraction. In the case that the color of the moving target is similar to that of the background pixel, there is a phenomenon of mission in background subtraction detection. And the shadow area is larger than the area of detected motion target, and the shadow is also detected together. Fig. 3.3(d) is a moving target detected by using this algorithm. This algorithm effectively eliminates the influence of shadows and detects different moving targets together.

shadow detection and contrast experiment
In this paper, the shadow is eliminated by comparing the pixel ratio with the threshold value, and the detection effect of the shadow removal is good. The

Concluding remarks
In this paper, in view of the deficiency of background subtraction and frame difference method, combined with the insensitivity of Canny edge detection operator to noise and illumination, an improved method for fusion of the three is proposed. The fusion of background subtraction and three-differential can complement the deficiency of both in the introduction. Using the property that the Canny edge information is insensitive to noise and light, the edge of the three-frame difference image is detected and filled into a moving blob, which is then merged with the previously obtained difference image. The interference of noise and environment mutation is effectively suppressed. The method of adaptive threshold is used to segment the fused image and enhance the detection effect. The shadow of the image is removed by comparing the pixel ratio with the threshold value.The experimental results show that the improved algorithm is better than traditional three-frame differential, mixed Gaussian background modeling method and background subtraction. It can remove voids and noise, and to some extent inhibits the influence of shadows on foreground detection. The limitations of this paper are that the effect of light treatment in complex situations is not very good, lighting cannot be completely eliminated, the processing method is too simple, and how to perform a more effective background modeling method remains to be studied, these are all aspects that need to be improved in the future.