You are on page 1of 7

Proceedings of the 2013 International Conference on Wavelet Analysis and Pattern Recognition, Tianjin, 14-17 July, 2013

An Improved Moving Objects Detection Algorithm


l
Liu Gang , Ning Shangkun \ You Yugan\ Wen Guanglei\ Zheng Siguo2
l
Automation Engineering Institute, Shanghai University of Electrical Power,
2
Electric Power Eco-Tech Institute,Shanghai Municipal Electric Power Company, State Grid Corporation of China,
liugang@shiep.edu.cn

Abstract to quickly and accurately detect out a moving target is still an


important research topic in the field of video tracking [2].
Moving target detection is an important part of video target
There has been a lot of moving target detection methods, of which
tracking. Good moving target detection makes video track more
the most important are the optical flow method, background
effective. This paper proposes a new algorithm based on the
subtraction, inter-frame differential method, and a series of improved
traditional three-frame differential method comparison. The
algorithm deriving from them. Among them, the optical flow method
shortage of traditional three-frame differential method is pointed
has a greater amount of computation, the higher requirements for
out. Combined with Canny edge detection algorithm, the
hardware, therefore, it generally difficult to do the real-time detection
improved three frame differential algorithm makes moving
the goal of with the method. Background subtraction method is much
target detected containing more complete information. This new
more demanding for background modeling and background update.
algorithm takes advantage of good performances of three-frame­
With this method, we need to quickly establish the background image
difference method and background subtraction method
and update the background in time so as to free from the influences
adequately. The proposed method is simple and experimental
of surrounding changes like lighting and interferences [3]. Although
results show that it can accurately detect moving targets.
inter-frame difference method can effectively remove static
Keywords background, often the objects detected by it are rough, and make the
Canny edge detection; Three-frame differential; Moving object actual profile of the moving objects much bigger than that of the
actual ones and have empty phenomenon empty phenomenon.
detection
This paper proposed an improved algorithm, which combines three­
frame differential method and image edge detection algorithm to get
1. Introduction the complete profile of the moving target, fill the regions of the target
with a series of mathematical morphology and connectivity detection
Moving target detection is an image processing procedure for remove small-scale noise, and make the complete moving region
extracting the moving objects which have a relatively apparent appear[4]. The method is proved effective via experimental
movement to background in image sequences based on their simulation.
characteristics of intensity, edge, texture, and so on. Its purpose is to
detect and extract moving foreground targets from their static
2. Inter-frame differential
background. Simply speaking, moving target detection is used to
check whether there is a moving object detected in a video sequence
existence, and determine the position of the moving object[l]. 2.1 Two-frame differential method
Moving target detection is the basis of the subsequent processing
target tracking, identification and behavior understanding. Whether Two-frame difference is a method used to detect moving targets by
the result that moving target detection gives is proper or not will getting the differential between current image and the previous image
directly affect the accuracy and stability of the follow-up processing, in video image sequence. Its fundamental principle is as follows:
even the whole system. However, due to changes in light, the shadow when the motion of an object appears in the sequence of video
of the moving target, interference from the background chaotic images, obvious changes between frames will arise. At this moment,
movement and the movement of the camera, and other factors, how subtract the two frames and get the absolute value of the gradation

978-1-4799-0417-4/13/$31.00 ©2013 IEEE


96
Proceedings of the 2013 International Conference on Wavelet Analysis and Pattern Recognition, Tianjin, 14-17 July, 2013

difference of images for two frames, compares with a threshold and 2.2 Three-frame differential method
then binarize the images to get the moving target [5]. To determine
whether there is a moving target and its location, formula is given as
The standard three-frame differential method on the basis of the two­
follows.
frame image differential, every two of three images taken connected
to the differential, then the differential image for further processing,
logical and operator, obtain the secondary differential results[6]. The
{I, If[1 I,(x,y)-I'_l(x,y) I> T]
S,(x,y) (1) schematic diagram is shown in Figure 2:
otherwise
=

0,

In the formula: It(x, y) and It-l(x, y) respectively represent the image


pixel values of point (x, y) at t and t - 1 time. T is the threshold value,
if the differential of an image value is greater than the threshold, St (x,
y) 1 means that the point is a moving target point, otherwise St (x,
=

y) 0 means that the point belongs to the background.


=

Inter-frame differential method excels for simple algorithm, low


complexity, strongly resistance to the light change, good ability to
Figure 2. Schematic diagram
adapt to various dynamic environments, a stable and efficient
detection. But it also has many disadvantages: For example, as shown
in Figure 1, during the movement of the target, since a part of the Standard three-frame differential method is that subtract a pair of
occluded background of the previous frame will appear in the current frames among three frame images on the basis of the difference of
frame so that this part of the background is also regarded as the the two frame images, and further process the differential images, i.e.
moving target, namely, AB will be detected as a target area. However, the logic AND operation, to get a secondary differential results. Ik_h
only B is the moving targets needed to be detected out. Therefore, it Ik, Ik +h respectively, means three consecutive frame images in the
will affects the target contour extraction and the "ghosting" will video. After two-frame method, we will get the differential dk and dk
appear when the object moves fast; Further, when the gradation + 1, among which dk 1 Ik-1-Ik 1 dk +1 1 Ik-Ik +1 I. After the logic AND
= =

information of the images of the two frames is little close (for operation on Dk and dk +1 differential image, we can get a final
example, the object is pure black), overlap area of A and B portion differential image Dk.
will not be detected as a motion area, forming "empty".
*This work was supported in part by National Natural Science
Foundation of China (No.6l2032241F030307), and the Sic-Tech
Innovation Foundation Shanghai Municipal Education Commission
(No.13YZlOl), and Shanghai Municipal Electric Power Company
Science and Technology Project (No.JYYBGKJ[2013]170), and kt-l
Shanghai Municipal Electric Power Company Science and
k
Technology Project (JYYBGKJ[2013]124).

B (a) (b)

AB
kt-1
kt-1

A k

Figure 1. Two-frame differential method

(c) (d)
Figure 3. Three-frame differential method

97
Proceedings of the 2013 International Conference on Wavelet Analysis and Pattern Recognition, Tianjin, 14-17 July, 2013

As shown in Figure 3 (a), the object moves from Frame k-t to Frame appear when the target is elongated with the two-frame differential
k. After the frame subtraction, we can get dk, the green and red method.
regions in the Figure, while dk+! is the green and blue region. After According to the three-frame differential described above, the
the logic AND operation, we can get Dk, the green region, i.e. the following is the indoor Lab's video target detection experiments. As
complete motion region in Frame k. Three-frame differential method shown in figure 4
successfully overcomes the shortcoming that the "ghosting" easily

(a) The 149th frame (b) The 150th frame (c) The 15lth frame

(d) First two frames differential (e) Follow two frames differential (t) Three-frame differential
Figure 4. Three-frame Differential

Figure 4 (d) is the 149th frame difference image with 150th frame. 3. Improved Algorithm
Figure 4 (e) is the 150th frame difference image with 151th frame.
There is an obvious "ghosting" phenomenon, and also caused the
3.1 Image Edge Detection
result of cavitation as the single colors of coat and trouser; (d) and (e)
make the And operation, then obtained the result of three-frame
differential as the figure 4 (t). As can be seen the results of the three The image edge detection is to detect the edge of the image. The edge
differential is effective removed the phenomenon of "ghosting", but of the image is the collection of pixels that has obvious step change
empty phenomenon still exists, and also the loss of part of the compared to the gray values of the surrounding pixels, and it is
boundary information. generally present in the junction between the region and region,
target and target, target and background. Edge has two characteristics:
along the trend of the edge of the image, the change to the pixel value
of the image is relatively flat; while along the vertical direction and
edge, the change to in pixel value is dramatic, presenting a step­
shaped or ramp-like way. The first order derivative of the pixel
values on the edge is great, and the second derivative value is zero at
the edges, showing zero-crossing. The edges of the image contain
most of the information of the image. Other features of the images

98
Proceedings of the 2013 International Conference on Wavelet Analysis and Pattern Recognition, Tianjin, 14-17 July, 2013

are derived based on the basic characteristics relevant to the edge and 3.2 Dilation Operation
the area. It is the basis of image segmentation and image matching.
Canny edge detector is the most popular tool for edge detection and The dilation operation is make all background points are merged into
has many applications in the areas of image processing, multimedia contact with the object in the object, so that the boundary outward
and computer vision [7]. The Canny algorithm optimizes the edge expansion process. It can be used to fill the holes in the object [9].
detection through noise filtering using an optimal function Dilation operation expressed by G EEl B , which is defined as
approximated by the first derivative of a Gaussian. The Canny edge
follows:
detector uses a filter based on the first derivative of a Gaussian to
suppress image noise. An edge in an image may point in a variety of
directions, so the traditional Canny algorithm uses various operators
to detect edges in the noise-filtered image in four directions:
(3)
horizontal, vertical and two diagonal directions. The use of an edge
detection operator returns a value of intensity gradient.
After Image filtering, we need stretching process to grayscale images
that make the image gray distribution wider range, and enhance the The formula (1) is based the image to obtain the origin of the B and
image contrast and edge rate of change. concrete treatment as shown a displacement of the image. The elements of G expanded by B are

{
in Equation 1: the set of a. B and G at least has one element overlap. The same
with other morphological operations, set B is often referred to as
0O:-:::;f(x,y)<u structural elements. Principle as shown below:

g(x,y)= [Mg/(V-u)J[f(x,y)-u] u:-:::;f(x,y)<V (2)

Mg V:-:::;f(x,y):-:::;Mj
Wherein M g = Mf = 255, u, V are constants.
o • i 0

According to the dramatic changes of gray degree of image edge, we 0 \ 0

can use the distribution of gray gradient to reflect this change. Classic
and simple edge detection method is to operator the edge of the G B
construction of a neighborhood of pixels in the original image. Since
Figure 6.Dilation Operation
the original image often contain noise, and edge and noise shares
similar characteristics on the spatial and frequency domain.
Therefore, it is difficult to distinguish them, making the image edge
detection difficult. The image edge detected via Canny operator edge
detection is the most complete, and the continuity is also very good 3.3 Local Boundary Connection
and the detection is better than other operators [8]. Although
theoretically, the complexity of Canny edge detection is highest, with In image edge detection, due to the presence of the pixel noise and
the rapid development of computer technology, its processing speed other factors, tends to make the edge of the image fracture and the
has been fully in line with the real-time requirements. brightness of the spurious is not continuous and is difficult to obtain
full edge characteristics. After a typical edge detection algorithm we
need to edge connection, some detected edge fragment was ligated
into a complete boundary. Analyze the characteristics of each point
(x, y) in the image with a small area, is one of the easiest method of
connecting edge. All in accordance with a predetermined criterion is
considered to be similar points are connected, formation an edge to
meet these criteria pixels. In this analysis process, to determine the
edge pixels of the similarity of the two main properties is the gradient
strength and gradient direction [10]. Therefore, if the following two
(a) Original image (b) Canny Algorithm
formulas:
Figure 5. Improved algorithm principle

99
Proceedings of the 2013 International Conference on Wavelet Analysis and Pattern Recognition, Tianjin, 14-17 July, 2013

IVg(XPYl)-Vg(x2,YJI � TG (4) Get three consecutive frame images


fk _l, fk, fk-I

la(XpYl)-a(X2'Y2)1 � Ta (5)
.. "

I I
Considered point(xl, y2) and the point (xl, y2) are located on the fk_1 and fk do
differential Extract the edge of
same one edge. Wherein, T is the gradient intensity similarity
G
I I
Three difference
.. K-th image by edge
method

I I
threshold value, T is the gradient direction for the similarity detection
a Dilation
threshold.
I
..

3.4 Improved Algorithm I And operation


I
..

I I
By edge detection and dilation operation, combined with the inter­
frame difference do some image pre-processing. And then combine Or operation

the three-fame differential method with local boundary connection to


get a complete image detection, to form a new method of moving +
target detection. Summarized as follows: Mathematical morphology and
connectivity detection
First get three frame images in a row and do differential between
Frame k-l and Frame k image to preliminary get moving target,
meanwhile, use canny operator to carry out image edge detection in �
order to extract edge profile of the current frame; after phase the
dilated differential image and edge detection results, the profile of
moving object can be obtained firstly. Three-frame differential
I Test results
I
method also can make the profile of the moving target available, but
generally make the profile discontinuous, so we phase the profile of Figure 7. Improved algorithm schematic
moving target obtained second time to get more complete profile
information. Edge profile of the moving target got here also contains
3.4.1 Experimental results and analysis
part of the edge contour inside the target [11]. After the connected
domain detection, many complex connected domains may exist,
which masks it is not easy to directly carry out area filling, and We use some standard video to experience[12].Then the improved
therefore we use some other methods to do a filling in disguised form. algorithm to do the video target detection experiment on indoor Lab,
The main idea is to exchange the black and white areas of the binary and the experimental result is shown in Figure 8 blow.
image. In connected domain marker detection, mark the original
black areas, to get the maximum connected domain as the
background, and give the assignment of 0, while all the remaining
area is the movement of the target area, give assignment of 1. Finally,
remove the connected domain less than 1% of the total area in order
to eliminate isolated noise points, so as to get the final movement
target area.
In this paper, on the basis of three-frame differential method,
combines the image edge detection, and proposes an improved
algorithm, of which principle is as shown in Figure 7.

100
Proceedings of the 2013 International Conference on Wavelet Analysis and Pattern Recognition, Tianjin, 14-17 July, 2013

(a) The 150th frame (b) Two frame differential (c) Expansion operation

(d) Canny edge detection (e) AND operation (f) Three frame differential

• . .
,- ,-

-- l1li' ... ... __ III' ... _ ...

"t ,J
A.
-'l. . -'l .
.. . .. .
.
'. '.
I . I . •

,,"
,\. . ,\. .
.� .� .- ..
(g) OR operation (h) Expansion (i) Black and white conversion

. .
,-

. . -- �
... . ... -_ .. ...... "-"

"! A
-
. .n . ..��
.. .
'. ,,
I . • I - .' " . 'Ie,_
,\. . . ,;..
"
.� . - .. �

(j) Small area to remove (k) Conversion and corrosion (1) Small area to remove
Figure 8. Improved algorithm experimental results

101
Proceedings of the 2013 International Conference on Wavelet Analysis and Pattern Recognition, Tianjin, 14-17 July, 2013

In Figure 8, (b) is for the two-frame differential image, which has Acknowledgements
empty phenomenon and ghosting; the result after AND operation on
(c) obtained after dilation and edge detection result (d); (f) is for the This work was supported in part by National Natural Science
three-frame differential image, although the ghosting is removed, a Foundation of China (No.612032241F030307), and the Sic-Tech
lot of edge information is lost, and the significant empty phenomenon Innovation Foundation Shanghai Municipal Education Commission
is still present; after phasing (e) and (f) , we can get a more complete (No.13YZI01), and Shanghai Municipal Electric Power Company
boundary contour diagram (g). The image (g) has a large number of Science and Technology Project (No.JYYBGKJ[2013]170), and
empty and noise point, we need to do a series of mathematical Shanghai Municipal Electric Power Company Science and
morphology process and connectivity testing on it. We can get (h) Technology Project (JYYBGKJ[2013]124).
after dilation operation on (g) and get (i) after exchange black and
white image of (h). And we can obtain FIG. G) by having a References
connected domain detection on (i) and retaining only the largest area
[1] Zhao Ming-ying and Zhao Jun. A novel method for moving
(i.e., a background area), we can get (k) after making a black and
object detection in intelligent video surveillance systems[C].
white conversion and corrosion on G), and then we complete filling International Conference on Computational Intelligence and
of the movement of the target area in a disguised form. There are still Security, Guangzhou, 2006, 2: 1797-1800.
some isolated noise points, so we should make fmal domain detection
and remove small areas to get the final test results (1). [2] Ritter G X, Wilson J N. Handbook of Computer Vision
Algorithms in Image Algebra. CRC Press, 2000.
From the above experimental results can be seen that the results of
this algorithm is still quite good, effective solution to the cavitation [3] Wang Yaoming,Wang Hao. Radon Transform and its
of the three difference method and edge deletion, and the Application to Image Recognition. Journal of Shanghai Dian Ji
computation involves only a simple image subtraction, corrosion University,2005,8(5):6-10.
expansion computing and connectivity detection computationally [4] Wang Bin, Pan Jianshou, Liang Yanbing, Moving detection of
intensive, time-consuming short track can well meet real-time video images based on Matrox card., Journal of Northwest
requirements. University. 2004,2(3), pp:I-7
Figure4(f) and Figure8(1) shows through comparison of the three­ [5] ZORAN Z. Recursive unsupervised learning of fmite mixture
frame differential with its improve can be shown as following: models [J].IEEE Transactions on Pattern Analysis and Machine
improved algorithm eliminates ghosting, complements most empty, Intelligence, 2010,26(5): 651-656.
and the boundary data to supplement complete, the results obtained
with the video closer to the target, which provides a good track for [6] WANG Bing, FAN Shao-sheng .An improved Canny edge
tracking part 0 bject. detection algorithm[C).2010 Second International Workshop on
Computer Science and Engineering,2009:497-500.
[7] ZHAO Hui-li, QIN Guo-feng, WANG Xingjian. Improvement
4. Conclusions of Canny algorithm based on pavement edge detection [C].201O
3rd International Congress on Image and Signal
This paper proposes a real-time moving target detection algorithm for Processing,2010:964-967.
the moving target detection with a static background on the basis of
[8] [2] R. Gonzalez and R. Woods, Digital Image Processing, 2nd
inter-frame differential and edge detection algorithm. The improved
ed. Upper Saddle River, NJ, USA: Prentice Hall, inc, 2002.
algorithm overcomes the empty phenomenon and edge deletion
problems of standard three-frame differential. It extracts the profile [9] Q. Zhang, T. S. Yeo, H. S. Tan, and Y. Luo, "Imaging of a
of the moving object and fills the empty space by a series of moving target with rotating parts based on the Hough
mathematical morphology. The improved algorithm still has some transform," IEEE Trans. Geosci. Remote Sens., vol. 46, no. 1,
limitations. In the environment with strong light and obvious shadow, pp. 291-299, Jan. 2008.
the effect is not ideal. It still needs further improvement. For [10] [4] Otsu, N., A threshold selection method from gray-level
backgrounds with changing conditions and jitter, the effect of this histograms. IEEE Trans. on System, Man and Cybernetics, 1979,
method to detect moving targets is not very ideal and we need to 9(1), pp. 62-66
further research and exploration. Another future research direction is
the background with translation transformation. [11] Muyun Weng, Mingyi He, "Image Detection Based on SUSAN
Method and Integrated Feature Matching" P], International
Journal of Innovative Computing, Information and
Control,Vol.4, No.3, March 2008. pp. 671--680.
[12] Gonzalez r c. Digital Image Processing Using MATLAB.
Beijing: Publishing House of Electronics Industry, 2000.

102

You might also like