Date of acceptance 11_5 _ 2009
Date of acceptance 11_5 _ 2009
7(2)2010
Abstract:
In this paper we present an operational computer vision system for real-time motion
detection and recording that can be used in surveillance system. The system captures a
video of a scene and identifies the frames that contains motion and record them in
such a way that only the frames that is important to us is recorded and a report is
made in the form of a movie is made and can be displayed. All parts that are captured
by the camera are recorded to compare both movies. This serves as both a proof-of-
concept and a verification of other existing algorithms for motion detection. Motion
frames are detected using frame differencing. The results of the experiments with the
system indicate the ability to minimize some of the problems false detection and
missed detections (like in a sudden change of light in the scene). The software part is
written in Matlab language as an M-file and using the Simulink library, the hardware
part we used a Pentium 4 computer with a web camera or a laptop integrated camera.
Key Words: motion detection, surveillance camera, computer vision, frames, real
time, Matlab Simulink.
Introduction:
The ability to track moving objects, and classifies those pixels of
from a moving platform is a skill significant variation into foreground.
required in a number of fields from Therefore, the success of frame
surveillance to robot-human interaction differencing depends on the robust
[1]. The purpose of this project is to extraction of the background image.
first develop a simulation model using The background can be modeled with a
Matlab Simulink that will take a live single adaptive Gaussian, and learnt
video feed and be able to recognize during an initialization period when the
and track moving objects as they move scene is empty. This method is
through the camera’s field of view. efficient only in less dynamic scenes
Once this is achieved the tracking of but has difficulties with vacillating
motion frames only is made by feeding backgrounds (e.g. moving trees,
the output Audio-Video file (AVI) to background elements moving, and fast
an M-file program that will select the illumination changes flood of sunlight,
frames that contains motion and submit shadows or lights switched on) [2].
a report with these frames. The project The system is mainly designed to be
uses the laptop camera or web camera used indoor and act as a guard that
to capture live data. Possible uses for detect and record any motion that
this project include security happens in an office for example when
surveillance for inside buildings and the building is empty.
surrounding areas. It's possible to compare the current
Frame differencing is a technique frame not with the previous one but
widely used for the change detection in with the first frame in the video
dynamic images. It compares each sequence. So, if there were no objects
incoming frame with a previous frame in the initial frame, comparison of the
*Computer Center / Baghdad University
1000
Baghdad Science Journal Vol.7(2)2010
current frame with the first one will record. This paper uses the Video and
give us the whole moving object Image Processing Blockset of the
independently of its motion speed. But, Matlab program to demonstrate the
the approach has a big disadvantage, if latter approach. The suggested model
there was, for example, a car on the of this project is shown in figure (1).
first frame, but then it is gone, we'll
always have motion detected on the
place, where the car was. Of course,
we can renew the initial frame
sometimes, but still it will not give us
good results in the cases where we can
not guarantee that the first frame will
contain only static background. But,
there can be an inverse situation. If we
put a picture on the wall in the room,
we will get motion detected until the Figure (1): The suggested model
initial frame will be renewed [3].
The most common approaches are to In this model, motion in the camera's
compare the current frame with the field of view triggers the capture of
previous one. It's useful in video "interesting" video frames. The frames
compression when we need to estimate are recorded live from any video
changes and to write only the changes, device attached to the computer that
not the whole frame. But it is not the contains the model. The model uses the
best one for motion detection two dimensions SUM OF ABSOLUTE
applications. Disadvantage of the DIFFERENCE (2-D SAD) block to
approach are: If the object is moving detect motion in the video sequence.
smoothly we'll receive small changes When the sum of absolute differences
from frame to frame. So, it's (SAD) value of a particular frame
impossible to get the whole moving exceeds a threshold, the demo records
object. Things become worse, when this video frame and displays it in the
the object is moving so slowly, when Motion Frames window [5].
the algorithms will not give any result The first device needed for motion
at all [4]. tracking is the camera for acquiring the
The limiting factor in deployment of real-time video stream. A video
these techniques is the frame-rate of capture device will digitize the output
currently available authenticating of the camera and write it to the hard-
cameras. It is expected, however, that drive to be manipulated later. A laptop
this limitation will be somewhat easier computer can be used equipped with a
and faster to remove than was the fast enough processor and enough
development of the processing RAM to run the computations. The
technology. heart of the design project is the
software program to analyze the
Material and Methods: incoming video stream, determine and
Security concerns mandate continuous select moving frame. The camera
monitoring of important locations chosen for this project is a Laptop
using video cameras. To efficiently Integrated Webcam. The algorithm
record, review, and archive this chosen to detect motion is the simplest
massive amount of data, we can either type to speed up calculation, so that we
reduce the video frame size or reduce can work on the real time. Once the
the total number of video frames we new image has been balanced in the
1001
Baghdad Science Journal Vol.7(2)2010
1002
Baghdad Science Journal Vol.7(2)2010
a very large size in the image and it device whether it contains motion or
exceeds the threshold by many times; not.
if the system is placed in the proposed
sized room or hall. The lighting in the
room must be constant, this project is
not designed to reduce the effects of
severe false alarm (like a sudden
change of light), we can reduce false
alarm by increasing the threshold but
this will reduce the accuracy. The
threshold used in this research is
obtained from other researches [5,6],
and it is tested for this program and
proved to be very efficient.
Testing of the system will first begin
with loading artificial or acquired Figure (4): Graphical User Interface
images to the software with a certain
result expected. Testing will be as The frame rate must be high enough to
simple as a person walking in front of allow each frame to capture the tracked
the camera and his or her motion object’s motion in small increments to
viewed on the screen. allow for the motion tracking to work
Using image-processing techniques, effectively. Also, the frame rate must
we will analyze a stream of images to be low enough to allow for the
detect motion frames. computation of each step in the motion
During the testing, 40 different videos detection process.
are fed to the system (27.5 hours of Too many frames will slow down the
video containing in total of 110,918 processing machine and the detection
frames) have been captured. The will fall behind without little chance of
program labeled 40,929 of the frames catching up. Ideally the camera should
(41.4%) as containing camera motion. capture grey frames [7]. If the camera
The Graphical User Interface (GUI) of captures in colors, it will just have to
the Program Shown in Figure (4). The be converted to grayscale at the
interface contains three buttons: processing level. It is estimated that a
1-Start Surveillance: When this frame rate of 30 frame/second should
button is pushed the suggested model perform well in this project.
will appear Figure [1], and we can start In this project all the frames that is
the surveillance camera action to captured from the device are given a
record the motion frames by pressing sequential number and all the frames
the start simulation button in the that is considered motion frames are
standard tool bar, choose simulation also given a different sequential
from the format menu Or, simply press number, so that we can visually
ctrl+T (short cut) in the keyboard, the compute the results and asses the work
resulted image is shown in figure (5). of the program during running time as
2-Show Motion Frames: This button shown in figure(6). When the
show a compact report for the motions execution of the program starts two
only in the scene that have taken place windows appears:
for the period of the detection that the The first window titled (Original): is
model have been working. the frames that is captured from the
3-Show all Frames: displays all the attached camera with no processing is
frames that is captured by the video
1003
Baghdad Science Journal Vol.7(2)2010
made on the frames, the frames motion is detected in a frame, this will
appears gray. give us a visual way to evaluate the
work of the program as it is being
executed.
While the above two windows are
made for human surveillance the M-
file program is designed to make a
brief report for the motions that took
place for all the frames that is captured
by the camera. This report is displayed
with the same structure of the motion
frames but with a very significant
difference, that is only the motion
frames are shown with no stand still
Figure (5): The captured frames from the images. The window will appear as if it
surveillance camera. contains one continuous movie because
all the redundant frames (frames with
The second window titled (Motion no motion) are discarded.
Frames): This window will capture the
frames that contain motion in them.
Only displaying the total amount of Conclusions:
frames captured, and the total amount Significant progress has been made
of motion frames. toward the goal of automatically
detecting motion in a surveillance
scenario. A significant amount of work
remains to be completed to achieve this
goal, and Smart Video is expected to
emerge as a mature technology in the
next few years. Nonetheless, the results
to date already offer potential benefits
in today’s remote monitoring.
The demonstrated ability to determine
that a scene change was not due to
lighting fluctuations, but was indeed
due to the movement of a discrete
object in the field of view has the
potential to dramatically reduce the
Figure (6): The program displays a window
false alarm rate. The following
of the motion images that is being captured.
conclusion can be drawn from testing
This window also appears when we the suggested model:
start the program. It will contain 1-frame differencing techniques are
frames for the motion only and it will suitable for indoor surveillance not for
stand still displaying the last frame that outdoor surveillance.
is moved if no motion take place in the 2-Gray color images is very suitable
current time although, the number of for surveillance cameras due to their
all frames changes, As the number of small size, while colored images will
all frames is always increasing increase the calculation unnecessarily.
constantly by one due to continuous 3- If the frame rate is too high the
capturing, the number of motion changes from scene to scene are so
frames is increased by one only when small that we cannot reliably extracted
a frame from noise.
1004
Baghdad Science Journal Vol.7(2)2010
4- The common annotation of camera 4.Choi, H., Gregory, M., Brozyna, R.,
motion has not only resulted in the Sgherza, J., Trumper, K., 2002.
availability of ground truth, but has “Motion Track / Object
also provided insights in the properties Recognition”. Pattern Recognition.
of this video feature and the way it is 7(2):7-14.
perceived by humans. 5. Gonzalez, R., Woods, R. Eddins, S.,
5- In some cases it has been difficult to 2004. “Digital image processing with
draw the line between instabilities of Matlab”.Adison-Wisely, Ed.4,USA.
the camera and real camera motion. PP:35-45 .
Special case of this problem is hand- 6.Ondrik, M., Kadner, S., Kraus, S. ,
held camera sequences. In such a case Thompson, V., 2005.” Motion
there can be intended camera motion, Detection Technologies” .Pattern
which is often difficult to separate RecognitionLetters,2(2):2-5.
from the instabilities that are always 7.Laptev, I., Belongie, S.J., Perez, P.,
present. Wills, J., 2006. “Periodic Motion
Detection and Segmentation via
Reference: Approximate Sequence Alignment”.
1.Renno, J., Lazarevic, N., D., Pattern Recognition Letters.9(5):5-7.
McManus and Jones, G.A., 2006. 8.Bailer, W., Schallauer, P., Thallinger,
“Evaluating Motion Detection G.,2005. “Camera Motion Detection”
Algorithms: Issues and Results”. .Sumitmo Electronic technical
Penrhyn Road, Kingston upon Review. 2(25):5.
Thames,Surrey,UK KT1 2EE.6(8):1. 9.Olson, C.F., Huttenlocher, D.P.,
2.Ming, X. and Ellis, T., 2001. 1997.”Automatic Target Recognition
“Illumination-Invariant Motion by Matching Oriented Edge Pixels”.
Detection Using Colour Mixture IEEE TRANSACTIONS ON
Models”, IEEE 29(8):163. IMAGE PROCESSING.3(4 ):2.
3.Bobruk, J., Austin, D., 2003, “Laser 10. Bhat, K.S., Saptharishi, M.,
Motion Detection and Hypothesis Khosla, P.K., 2001. “Motion
Tracking from a Mobile Platform”, Detection and Segmentation Using
Pattern Recognition. 6(2 ):3. Image Mosaics”. Pattern Recognition
Letters. 2(2):6.
:الخالصة
يقدم هذا البحث ًظاها عوليًا لرؤيت الحاسبت لوراقبت الحركت وحسجييلاا يعوجف جل الجزهي الحقيقجل ويوتجي اسجخ داهت
يقوم الٌظام بخسييف الوقاطع الفلويت لووقع هحدد ويخعرف على الصجو الخجل ححخجو علجى كركجت.ل ًظام هراقبت
ويقوم بخسييلاا بطريقت بحيث اًه يسيف قط الوٌاظر الواوت لٌا والخل كصلج باا كركت ويقوم بعوجف حقريجر علجى
هع العلجن اى جويجع اججزال الوقطجع الفلوجل الجذ.شتف هقطع لول ه خصر عي الحركت قط يوتي عرض هذا الفلن
وا بخججج الٌخججاخل الوسخ لصججت اججحت الٌظريججاث.حلخقطججت التججاهيرا يججخن حسججييلاا لتججل حججخن الوقا ًججت بججيي الوقطعججيي
حن ححديد الوٌاظر الخل ححخو على كركت هجي الج ا اسجخ دام الوا ةهيجت طجرن الوٌظجر.الووجودة لتشف الحركت
وقججد ا بخججج الٌخججاخل اى الٌظججام يوتٌججت اى يخيججاوة بعججط هججي هشججاكف الوراقبججت ه ججف.الحججالل هججي الوٌظججر الججذ سججبقت
هجع الخعرف ال اطئ على الحركت( وقد حن اًيجاة اليجزل البراهيجل هجي العوجف باسجخ دام برًجاهل برًجاهل الوجاح
حخصف باجا4 اها الوتوًاث الواديت للعوف خن اسخ دام كاسبت بٌخيوم, اسخ دام هتخبت السويولٌك ل برًاهل الواح
.) كاهيرا ويب او اسخ دام كاهيرا هظوٌت ل الحاسبت البخو
1005