Open Access Paper
28 December 2022 Moving object detection based on enhanced frame difference
Yong Fan, Liwei Tian, Lei Yang
Author Affiliations +
Proceedings Volume 12506, Third International Conference on Computer Science and Communication Technology (ICCSCT 2022); 125061C (2022) https://doi.org/10.1117/12.2662562
Event: International Conference on Computer Science and Communication Technology (ICCSCT 2022), 2022, Beijing, China
Abstract
Aiming at the problem that frame difference method will deal with the moving target incorrectly when the target moves slowly or stops for some times, a novel method based on frame difference for moving object detection is proposed. Firstly, the algorithm confirms the number of frames used to generate background by comparing the binary frame difference of the current frame with the initial binary frame difference and establishes the background model using the determined frame; Then the background subtraction method is utilized to detect the moving object through the established background. Relevant experiments show that the algorithm can better deal with the detection of slow-moving targets.

1.

INTRODUCTION

Target detection is widely used in video processing. It is the basis of video compression, coding, target behavior understanding, target recognition. It is one of the vital issues in computer vision. At present, the methods for target detection can be roughly divided into background-based and classifier-based. The detection methods based on background model mainly include Gaussian mixture model, inter difference, kernel density estimation, optical flow method and other methods1-4. This method distinguishes the target from the background by detecting the brightness change between two adjacent frames. Classifier based detection methods learn the differences between objectives and backgrounds through training samples. Such methods are commonly used, such as neural networks, decision trees, support vector machines, etc.5-9. Although the classifier based method has many advantages over the traditional background model method, it also has some defects, such as the need for a large number of label data, the need for long-term training and so on. The principle of the difference is to regard the pixels with large differences in pixel values in the two adjacent frames as the foreground target. This method only needs to calculate the difference of adjacent frames to extract the foreground. Based on the previous analysis, this paper only studies the frame difference method.

Up to now, many frame differences have been proposed and applied to current detection. Zhang Y, et al. proposed a method to extract moving target by three frame differences10. Han X et al. proposed a method using difference and optical flow to detect the moving object11. He L et al. proposed a target detection method based on subtraction12. Huang J et al. proposed an object detection method based on visual background extractor (ViBe) and five-frame difference13. Q. Zhang et al. proposed a method for target detection based on five frame difference to solve the problems of ghost and shadow14. However, on the case that the moving speed of the target is slow, or the target stops halfway, these algorithms have the problem of mistakenly treating the overlapping part of the two frames of the target as the background.

To solve the above problems, an enhanced method for moving object detection based on frame difference is proposed in this paper. This method determines the number of frames that generate the initial background by comparing the binary frame difference of the operating frame with the initial binary difference; And establish the background model; Then we use the background subtraction method to extract the moving target. Relevant experiments show that the method has a good effect on intermittent video processing. The contributions of this article are as follows:

  • (1) An adaptive method of building video background model is proposed to avoid the problem of using a fixed number of frames.

  • (2) The minimum circumscribed rectangle is proposed to improve the effect of generating background model.

2.

THE PROPOSED METHOD

2.1

Frame difference

Over the last decade, significant works including difference method which is used to detect the moving object have been proposed. The basic principle of the frame difference is to subtract adjacent frame, which is described as follow.

00070_PSISDG12506_125061C_page_2_1.jpg

where Dk(x,y) is the frame difference of the two adjacent frames, fk(x,y) and fk−1 (x,y). The binarized matrix Bk:is obtained by equation (2),

00070_PSISDG12506_125061C_page_2_2.jpg

where th is the threshold decided by OSTU method. If the value of a pixel is less than threshold th, the point is regarded as background (stationary). Otherwise, it is judged as the foreground (the moving target).

2.2

The proposed method

Traditional modeling methods such as three frame difference and five frame difference can not correctly discriminate the background and the moving object when the moving object moves slowly or stops in the movement. Therefore, we proposed a moving object detection based on an enhanced frame difference method. The method consists of three phases: background modeling, background updating and target extraction. The whole process is shown in Figure 1.

Figure 1.

The flowchart of the proposed method.

00070_PSISDG12506_125061C_page_3_1.jpg

2.2.1

Background Modeling.

This module is used to establish the initial background Ig without foreground. The key steps are as follows.

Initialization: Set Ig, Ng to a zero matrix with the same size as the frame, and set k = 2.

  • (1) The first three frames of video fk–1, fk, and fk+1 are input.

  • (2) The frame difference Dk and Dk+l are calculated respectively by using equation (1).

  • (3) We use equation (2) to binarize Dk and Dk+1, to get Bk and Bk+l, and set Ig = 0.5Bk* (fk–1 + fk), Ng = Bk, where ~ representatives comprehensive operation.

  • (4) Morphological operation and outlier removal operation are executed on Bk and Bk+1.

  • (5) The foreground in Bk and Bk+1 with the minimum circumscribed rectangle are masked.

  • (6) The intersection of B2 and Bk+1 is found by using equation (3), and the number of common pixels nu in the intersection is calculated by equation (4).

    00070_PSISDG12506_125061C_page_2_3.jpg

    where ∩ represents and operation.

    00070_PSISDG12506_125061C_page_2_4.jpg

  • (7) Ng is set to Ng + Bk+1.

  • (8) The intermediate generated background Ig is calculated using equation (5):

    00070_PSISDG12506_125061C_page_3_2.jpg

  • (9) We judge whether the value of nu is equal to 0, if not, go to step (10); Otherwise, get the initial background Ig and enter the target detection module.

  • (10) We input the next frame k+2, set k=k+1, and use equation (1) and (2) to get the binary frame difference. After that, we go to step (6).

2.2.2

Target Detection. It includes two steps.

  • (1) We use equation (6) to calculate the frame difference between the (k+1)th frame and Ig.

    00070_PSISDG12506_125061C_page_4_1.jpg

  • (2) mt is binarized by OSTU, and the result is carried out morphological processing to obtain the moving target.

3.

THE EXPERIMENT

The experiments are carried out on sample video using matlab2019b. Figure 2 shows the case of generating the minimum circumscribed rectangle for the frame difference, which can better block the moving foreground.

Figure 2.

Frame and its corresponding Minimum Circumscribed Rectangle (MCR).

00070_PSISDG12506_125061C_page_4_2.jpg

Figure 3 shows the change of the intersection Is(x, y) of the minimum circumscribed rectangles Bk+l(x, y) and B2(x, y) of the current frame difference. When the number of frames is 40, the minimum circumscribed rectangle mask of the current frame and the minimum circumscribed rectangle mask of the second frame do not overlap, and the result is the initial background generated by the algorithm.

Figure 3.

Initial background generation process.

00070_PSISDG12506_125061C_page_4_3.jpg

Figure 4 shows the moving foreground target obtained by using the established model and using the frame difference method and morphological processing. It can be seen obviously that the proposed method can detect moving people effectively.

Figure 4.

Moving target detection by using proposed method.

00070_PSISDG12506_125061C_page_5_1.jpg

4.

CONCLUSION

For the moving target detection under the fixed camera, this paper proposed an enhanced frame difference method to solve the problem on the case that the moving object moves slowly, the target overlaps and cannot distinguish the target correctly. This method models the background by adaptively selecting the number of frames, and solves the problem of false targets that may occur in the other frame difference method such as three or five frame difference method. In addition, the proposed minimum circumscribed rectangle method can better solve the problem of incomplete target edges that may occur when the targets overlap. Relevant experiments show that this algorithm has a good effect for the detection of slow moving targets. Then the algorithm still has some limitations, and the next step will be to do further research for complex situations.

ACKNOWLEDGMENTS

This paper was financially supported by Dongguan Science and Technology of Social Development Program (20211800904192) and research project of Guangdong University of Science and Technology (NO.GKY-2019KYYB-29).

REFERENCES

[1] 

Ju, J. and Xing, J., “Moving object detection based on smoothing three frame difference method fused with RPCA,” Multimedia Tools and Applications, 78 (21), 29937 –29951 (2019). https://doi.org/10.1007/s11042-018-6710-1 Google Scholar

[2] 

Lee, D. S., “Effective Gaussian mixture learning for video background subtraction,” IEEE transactions on Pattern Analysis and Machine Intelligence, 27 (5), 827 –832 (2005). https://doi.org/10.1109/TPAMI.2005.102 Google Scholar

[3] 

C. Stauffer, Eric, W., Eric, W. and Grimson, L., “Learning patterns of activity using real-time tracking,” Trans. on Pami, 22 (8), 747 –757 (2000). https://doi.org/10.1109/34.868677 Google Scholar

[4] 

Elgammal, A., et al., “Background and foreground modeling using nonparametric kernel density estimation for visual surveillance,” in Proceedings of the IEEE, 1151 –1163 (2002). Google Scholar

[5] 

Zeng, D., Zhu, M. and Kuijper, A., “Combining background subtraction algorithms with convolutional neural network,” Journal of Electronic Imaging, 28 (1), (2019). https://doi.org/10.1117/1.JEI.28.1.013011 Google Scholar

[6] 

Zeng, D., Chen, X., Zhu, M., et al., “Background subtraction with real-time semantic segmentation,” IEEE Access, 7 153869 –153884 (2019). https://doi.org/10.1109/Access.6287639 Google Scholar

[7] 

Björklund, S., “Target detection and classification of small drones by boosting on radar micro-doppler,” in 2018 15th European Radar Conference (EuRAD), 182 –185 (2018). Google Scholar

[8] 

Girshick, R., et al., “Region-based convolutional networks for accurate object detection and segmentation,” IEEE Transactions on Pattern Analysis & Machine Intelligence, 38 (1), 142 –158 (2015). https://doi.org/10.1109/TPAMI.2015.2437384 Google Scholar

[9] 

Wang, Q., Cheng, Y., Liu, C., Cheng, S. and Yang, S., “Target detection method in BTR based on SVM,” 2021 China Automation Congress (CAC), 1509 –1514 (2021). https://doi.org/10.1109/CAC53003.2021.9728060 Google Scholar

[10] 

Zhang, Y., Wang, X. and Qu B., “Three-frame difference algorithm research based on mathematical morphology,” Procedia Engineering, 29 2705 –2709 (2012). https://doi.org/10.1016/j.proeng.2012.01.376 Google Scholar

[11] 

Han, X., Gao, Y., Lu, Z., et al., “Research on moving object detection algorithm based on improved three frame difference method and optical flow,” IMCCC, 580 –584 IEEE,2015). Google Scholar

[12] 

He, L. and Ge, L., “CamShift target tracking based on the combination of inter-frame difference and background difference,” CCC, 9461 –9465 IEEE,2018). Google Scholar

[13] 

Huang, J., Xu, H., Sun, F., et al., “The method of mobile robot visual contaminant detection based on five-frame difference and visual background extractor,” AIM, 477 –482 IEEE,2019). Google Scholar

[14] 

Zhang, Q., Wei, L. and Li, T., “An improved ViBe method for motion target detection,” ICCCR, 258 –262 (2022). Google Scholar
© (2022) COPYRIGHT Society of Photo-Optical Instrumentation Engineers (SPIE). Downloading of the abstract is permitted for personal use only.
Yong Fan, Liwei Tian, and Lei Yang "Moving object detection based on enhanced frame difference", Proc. SPIE 12506, Third International Conference on Computer Science and Communication Technology (ICCSCT 2022), 125061C (28 December 2022); https://doi.org/10.1117/12.2662562
Advertisement
Advertisement
RIGHTS & PERMISSIONS
Get copyright permission  Get copyright permission on Copyright Marketplace
KEYWORDS
Target detection

Detection and tracking algorithms

Binary data

Berkelium

Video

Visual process modeling

Data modeling

Back to Top