Sie sind auf Seite 1von 19

Date: 22.04.

2019

Engineering Analysis and Design – ECN 206

MATLAB PROJECT

Title- Using MATLAB to Create an Intrusion Detecting Security Camera Alarm


using Image Processing Toolbox

Submitted by:
1. Apoorva Suri – 17105024
2. Kritika Garg - 17105039
Acknowledgement

The success and final outcome of this project required a lot of guidance and assistance from
many people and we are extremely privileged to have got this all along the completion of our
project. All that we have done is only due to such supervision and assistance and we would not
forget to thank them.

We respect and thank Mr. Sukhwinder Singh, who gave us the golden opportunity to do this
wonderful project, which also helped us in doing a lot of research and we came to know about
so many new things. We are extremely thankful to him for providing such a nice support and
guidance, although he has a busy schedule.

We are thankful to and fortunate enough to get constant encouragement, support and
guidance from all Teaching staffs of Electronics and Communication Department which helped
us in successfully completing our project work. Also, we would like to extend our sincere esteems
to all staff in laboratory for their timely support.

We would also like to thank our parents and friends who helped us a lot in finalizing this project
within the limited time frame.
Using MATLAB to Create an Intrusion Detecting Security Camera Alarm using
Image Processing Toolbox
Executive Summary
Detecting an intruder through the use of webcam is an important capability in today’s fast
world. This project note will cover a basic step-by-step algorithm for detecting an intruder in a
live video being taken using in-built laptop webcam.
Objective
Through this project note you will be able to write a MATLAB script file to import an image,
segment the image in order to isolate the desired object from its background and then use the
MATLAB functions that come with the Image Processing Toolbox to further enhance the
accuracy and efficiency of detection. Further, using loop we will be able to implement this
detection for live videos through webcam as well, thus creating a security camera.
Introduction
MATLAB is a high-level language and interactive environment for computer computation,
visualization, and programming. Image Processing Toolbox is an application available for use in
MATLAB, which provides a comprehensive set of reference-standard algorithms, functions, and
apps for image processing analysis, visualization, and algorithm development. Using these tools
provides a fast and convenient way to process and analyze images without the need for
advanced knowledge of a complex coding language.
Hardware
Computer system with built-in webcam
Software

 MATLAB R2018a
 Image Processing Toolbox (Downloadable application)
 MATLAB Support Package for USB Webcams
Process

 Firstly, we have created a script file ‘Image_Detection.m’ which performs image


processing on two static frames (images).
The various steps involved are:
1. Read in 2 images using imread() and display these colour images using imshow().
2. Convert images to black and white using rgb2gray() and display these black and
white images using imshow().
3. Subtract b&w images using abs().
4. Find maximum location of difference (red dot).
5. Use imtool() to determine threshold and lengh.
6. Threshold image – Here, we say that anything below the intensity of 8, we are going
to drop i.e. assign it a 0(black) and anything equal to or greather than 8, we are
going to keep i.e. assign it a 1(white).
7. Fill in regions – Here, we use a function called bwareaopen() which is a
morphological operator. We pass a binary image and everything that has an area of
15 pixels or larger, we keep that is assign it a 1(white). Everything else we drop, i.e.
assign it a 0(black).
8. Image overlay – Here, we use a function called imoverlay(). This function is not from
MATLAB. It is a utility which we have downloaded from MATLAB Cental>File
Exchange.
9. In the next step we disregard the things which are less than 80 pixels in length (such
as a pet) because we are looking for a human intruder. We use the function
regionprops() and find the objects ‘MajorAxisLength’. Then we keep the length only
if it is >=80.
10. If length is >=80 then we use disp() function to print ‘Something is Here!’ otherwise
we display ‘Nothing Different Here’.

 Then, I have created another script file ‘Segmentation_Fn.m’ which is similar to


‘Image_Dectection.m’, the only addition being that we have created a function
‘Segmentation_Fn’ which calls this script file and takes into argument two images and
returns the overlay image (intruder highlighted). We will call this function in our third
and final script file.

 Lastly, we have created our final script file ‘Security_Cam.m’.

The various steps followed are:


1. Setup Image Acquisition – We installed the MATLAB Support Package for
USB Webcams which enables you to bring live images from any USB video class
(UVC) compliant webcam into MATLAB. This includes webcams that may be built
into laptops or other devices, as well as those that plug into your computer via
USB port.
2. We created our webcam handle ‘hCamera’.
3. Then we acquired our reference image ‘ref_vid_img’ using snapshot(hCamera).
4. Then, we ran a loop for 2000 frames. It performed two major steps in a single
iteration.
a) Acquire an image from the webcam ‘vid_img’.
b) Call the live segmentation function ‘Segmentation_Fn’.
5. Shutdown webcam.
Real-life application of Security Alarm
A burglar alarm is designed in such a way to detect intrusion & unauthorized entry into a
building or anywhere where it is fixed. It is used as a personal protection against intruders &
can be used in commercial, residential & industrial areas.
Bibliography

 https://www.mathworks.com/?requestedDomain=

 MATLAB: An Introduction with Applications 4th Edition by Amos Gilat

Das könnte Ihnen auch gefallen