Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 70

DEVELOPMENT OF A SURVEILLANCE AND DETECTION SYSTEM

By

EBENUWA GODSON MARVELOUS

PSC1707442

DEPARTMENT OF COMPUTER SCIENCES

FACULTY OF PHYSICAL SCIENCES

UNIVERSITY OF BENIN

BENIN CITY

DECEMBER, 2022
DEVELOPMENT OF A SURVEILLANCE AND DETECTION SYSTEM

By

EBENUWA GODSON MARVELOUS

PSC1707442

BEING A PROJECT SUBMITTED TO THE DEPARTMENT OF COMPUTER


SCIENCES, IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE
AWARD OF THE BACHELOR OF SCIENCE (B.SC) DEGREE IN COMPUTER
SCIENCE, FACULTY OF PHYSICAL SCIENCE, UNIVERSITY OF BENIN, BENIN
CITY.

DECEMBER, 2022
CERTIFICATION

This is to certify that this project work was carried out by EBENUWA GODSON
MARVELOUS in the Department of computer science of the Faculty of Physical Science,
University of Benin.

___________________________ ___________________

Prof. Mrs. S. Konyeha Date

(project supervisor)
APPROVAL

This project work is hereby approved by the Department of Computer Science, Faculty of
Physical Science, University of Benin, in partial fulfillment for the award of Bachelor of Science
(B.Sc). degree in computer science.

______________________ ___________________

Prof. Mrs. S. Konyeha Date

(Project Supervisor)

_____________________ ___________________

Prof. Mrs A. O. Egwali Date

(Head of Department)
DEDICATION

This Project work is dedicated to God Almighty for his goodness in my life throughout my study
in this noble institution.
ACKNOWLEDGEMENT

I wish to appreciate and give gratitude to God Almighty for his abundance grace, guide and
protection throughout the period of this study. I sincerely acknowledge with great gratitude to
my supervisor Prof. Mrs. S. Konyeha for her support, encouragement, advice and time she spent
putting me through in this project despite his busy schedule, Also to my Head of Department
Prof. Mrs A. O. Egwali and to Dr. Mrs. Osubor for her motherly role and support, I also express
my gratitude to all my lecturers in Computer Science Department Prof. Frank Amadin, Prof. A.
A. Imiavian, Dr. K. C. Ukaocha, Dr. E. P. Ebitomere, Prof. Mrs. Egbokhare, Mr. S. O. P.
Oliomogbe, Mrs O. I. Usiosefe, Mr. E. Nwelih, Mr. E. E. Obasohan, Mrs. N. E. O. Agbonlahor,
Mrs. S.O. P. Oliomogbem, Mrs. R. A. Usiobaifo, Mr. F. Osagie, Mr. E. Obayagbona, Mrs. T.
Agenmonmen, Mrs. O. Aziken, Mr. E. C. Igodan Dr. Obi, Dr. Mrs. R. O. Osaseri, Prof. Mrs A.
O. Egwali, Mrs. A. R. Usiobaifo, Mr. K. O. Otikiti, Mr. Odetayo, Mr. Ojo Solomon for all their
support throughout my time in the Department of Computer Science.

My Family especially my parents Mr. and Mrs. Ebenuwa for their financial supports and also to
my siblings and my friends for their love and support, God bless you all.
ABSTRACT

Security is a big issue in Nigeria and the world at large. Therefore, there is definitely a need for a

surveillance system for our homes and offices which can be accessed via a PC or mobile phone.

This research concentrates on developing an automatic system to replace the need for human

monitoring. In this work we implemented a surveillance system to detect intruders and notify

security staff using computer vision and email communication technologies. The system is also

cost effective and easy to implement. This developed project uses one hikvision ip camera and

one router. The motion detection algorithm was coded in Python OpenCV library in combination

with AgentUI to provide database, thread handling and local server capabilities. We tested the

system to verify that the system operated as expected. The test results were satisfactory.
TABLE OF CONTENT

TITLE..............................................................................................................................................ii
CERTIFICATION .........................................................................................................................iii
DEDICATION................................................................................................................................iv
ACKNOWLEDGEMENTS ............................................................................................................v
ABSTRACT...................................................................................................................................vi
TABLE OF CONTENT................................................................................................................vii
LIST OF FIGURES.........................................................................................................................x
LIST OF PLATES..........................................................................................................................xi
LIST OF TABLES........................................................................................................................xii

CHAPTER ONE: INTRODUCTION


1.1 Background of the study............................................................................................................1
1.2 Statement of the research problem............................................................................................2
1.3 Aim and objectives of the study................................................................................................3
1.4 Significance of the study ..........................................................................................................3
1.5 Scope and limitations of the study ............................................................................................4

CHAPTER TWO: LITERATURE REVIEW


2.1 Introduction ...............................................................................................................................5
2.2 Review of related works............................................................................................................5
2.3 Weakness of the existing system ..............................................................................................6
2.4 Internet of Things (IoT) ............................................................................................................6
2.5 The need for IoT in traditional surveillance systems ................................................................7
2.6 Benefits of IoT solutions for surveillance systems....................................................................7
2.7 Disadvantages of Internet of Things..........................................................................................8
2.8 Motion detection .......................................................................................................................8
2.8.1 Motion detection for video surveillance ...............................................................................9
2.8.2 Operation of motion detection.............................................................................................11
2.9 Benefits of using motion detection for video surveillance......................................................13
2.10 Intellectual video surveillance...............................................................................................14
2.11 Computer vision.....................................................................................................................14
2.12 Internet communication principles .......................................................................................15
2.12.1 Internet protocol suite (TCP/IP) .......................................................................................16

2.12.2 IP address 16
2.12.3 Subnetting .........................................................................................................................16

2.12.4 Transmission Control Protocol (TCP) 16


2.13 Definition of terms.................................................................................................................17
2.14 Summary of literature review ...............................................................................................18

CHAPTER THREE: METHODOLOGY


3.1 Introduction .............................................................................................................................19
3.2 Design of the proposed system ...............................................................................................20
3.3 System analysis .......................................................................................................................20
3.3.1 Hardware (equipment).........................................................................................................20
3.3.2 Equipment and setup............................................................................................................20
3.3.3 Package contents..................................................................................................................20
3.4 Hardware installation...............................................................................................................21
3.4.1 Connecting to the PoE adapter............................................................................................21
3.4.2 Activation via SADP software ............................................................................................22
3.5 Device specifications ..............................................................................................................23

3.5.1 IP camera technical specifications 23

3.5.2 Router technical specifications 25


3.6 Software ..................................................................................................................................27
3.7 Motion detection algorithm ....................................................................................................28
3.7.1 Motion detection using background subtraction approach .................................................28
3.8 Use case diagram of the system ..............................................................................................33
3.9 Overall model of the system ...................................................................................................34
3.10 Sequence diagram of the system ...........................................................................................35
3.11 Class diagram of the system..................................................................................................36

CHAPTER FOUR: IMPLEMENATION AND TESTING


4.1 System implementation ..........................................................................................................37
4.2 System testing .........................................................................................................................42
4.3 Test result ................................................................................................................................42
4.3.1 Hardware test result ............................................................................................................42
4.3.1.1 Ping test on the IP camera .............................................................................................43
4.3.1.2 Network performance test ..............................................................................................44
4.3.2 Software behavioural test result...........................................................................................49
4.4 Bill of engineering measurement and evaluation ...................................................................50

CHAPTER FIVE: SUMMARY, CONCLUSION AND RECOMMENDATIONS


5.1 Summary..................................................................................................................................51
5.2 Conclusion ..............................................................................................................................51
5.3 Recommendations ...................................................................................................................51

REFERENCES............................................................................................................................52

APPENDIX A: MOTION DETECTION AND EMAIL NOTIFICATION CODE 55


LIST OF FIGURES

Figure 3.1 Architectural diagram of the system ...........................................................................19


Figure 3.2 Motion detection block diagram .................................................................................28
Figure 3.3 Computer vision using background subtraction source ..............................................29
Figure 3.4 Background subtraction process ..................................................................................32
Figure 3.5 Use case diagram of the surveillance system ..............................................................33
Figure 3.6 Overall model of the surveillance system ..................................................................34
Figure 3.7 Sequence diagram of the surveillance system .............................................................35
Figure 3.8 Class diagram of the surveillance system ...................................................................36
Figure 4.1 Server network performance without stream ..............................................................46
Figure 4.2 Client network performance without stream ...............................................................47
Figure 4.3 Server network performance on stream ......................................................................47
Figure 4.4 Client network performance on stream .......................................................................48
LIST OF PLATES

Plate 3.1 Detecting the IP Camera via SADP software ................................................................22


Plate 3.2 Activating the IP Camera via the SADP software .........................................................22
Plate 3.3 HikVision IP Camera .....................................................................................................23
Plate 3.4 TP-link router .................................................................................................................25
Plate 4.1 Workstation of the surveillance system .........................................................................38
Plate 4.2 Login interface ...............................................................................................................39
Plate 4.3 Adding the IP camera to the software ............................................................................39
Plate 4.4 User interface of the software streaming the IP camera feed.........................................40
Plate 4.5 Setting up the alerting system ........................................................................................40
Plate 4.6 Triggering the motion detector ......................................................................................41
Plate 4.7 Received email notification of detected motion ............................................................41
Plate 4.8 Recordings automatically taken by the surveillance system .........................................41
Plate 4.9 Result of the ping test ....................................................................................................43
Plate 4.10 Default IP and subnet mask .........................................................................................43
Plate 4.11 Starting up a Jperf server .............................................................................................44
Plate 4.12 Getting the server IP from the command prompt ........................................................45
Plate 4.13 Network performance result ........................................................................................45
LIST OF TABLES

Table 4.1 Network performance result on the server side with no stream ...................................46
Table 4.2 Network performance result on the client side with no stream ....................................47
Table 4.3 Network performance on server side with stream ........................................................47
Table 4.4 Network performance on client side with stream .........................................................48
Table 4.5 Comparison between expected and actual results ........................................................49
Table 4.6 Bill of Engineering Measurement and Evaluation (BEME) .........................................50
CHAPTER ONE

INTRODUCTION

1.1 BACKGROUND OF THE STUDY

Security is important for every organization. In the traditional security system, if there is an

illegal invasion that cannot be detected in a timely manner, then it is not possible to provide

evidence for tracking because there is no automatic alerting mechanism in place. (Norris &

Armstrong, 1998). Iyapo et al. (2018) stated that the degree of protection from danger, loss, and

crime is referred to as security. In addition, a report by Statista written by Simona Varrella in

2021, reported over 135000 crimes reported in Nigeria of which 68600 were crimes against

property while 536k00 were crimes against persons.

Video surveillance is an application of computer engineering to the domain of security. The

function of video surveillance includes camera control, video display, data recording and

transmission. Traditional video surveillance refers to analogue monitoring and digital

monitoring, and its infrastructure include a front-side camera, transmission cable, and video

monitoring platform. (Hossan, et al, 2012).

Before the wide spread of IoT technologies and methods, security surveillance systems had to be

monitored by a security staff on ground. There was no way of triggering events based on certain

parameters and hence made for an efficient but ineffective mode of surveillance. Accurately

detecting humans and motion in a video surveillance system is critical for a variety of

applications such as abnormal event detection, human characterization, person identification,

gender classification, and fall detection for the elderly. The initial stage in the detection

procedure is to detect a moving item. Object identification methods such as background removal,

1
optical flow, and spatio-temporal filtering might be used. When a moving item is discovered, it

can be categorized as a person using shape-based, texture-based, or motion-based characteristics

(Paul et al., 2013). Alzughaibi et al., (2015) explained that foreground detection or backdrop

removal refers to the broad method of detecting moving objects in films captured by stationary

cameras. This is widely used to identify human activities, object tracking, traffic monitoring,

computer vision applications, and human computer interaction. Objects in motion, often known

as the foreground, must be separated from static information for this process to work. This static

information is referred to as the backdrop, and the background subtraction method is commonly

employed for this.

Huang (2011) aimed for a high-tech video surveillance system. His approach categorizes motion

detecting technologies into three categories.

1. Background subtraction

2. Temporal differencing

3. Optical flow

This research makes use of the background subtraction approach for motion detection.

1.2 STATEMENT OF THE RESEARCH PROBLEM

Due to the rise in security challenges and the ineffectiveness of the popular surveillance system

currently in use, which involves personnel being around the area of surveillance. A more suitable

approach of solving security surveillance issues is required. One that eliminates the requirements

for a staff to be physically present while also boosting the security through advanced technical

techniques.

Securing lives and property is of topmost importance and hence a motivation for this study.
1.3 AIM AND OBJECTIVES OF THE STUDY

The fundamental aim of the study is to design and implement a web based security surveillance

system. The study will put into consideration the cost and ease of installation. The design

methods: IP Camera connection, software programming, IoT linking, real-time computer vision

analysis, will all be documented.

The objectives of the study are as follows:

1. To design a web-based application that will detect motion using background subtraction

technique also elimination environmental noise.

2. To implement a surveillance and detection system

3. To set up a test bed to test the effectiveness of the system.

1.4 SIGNIFICANCE OF THE STUDY

The world is being digitized every day and corporations are looking for the best ways to reduce

manpower and improved results with the use of automatic techniques. Security is a major, never

ending, concern in any organization and this research will help shed light on security

surveillance techniques via IoT. This will not only help students benefit from the wealth of

knowledge that will be shared, but will also add to the existing studies on home security and

surveillance systems.

1.5 SCOPE AND LIMITATIONS OF THE STUDY

Based on the objectives of the study, the scope of this research is to design and implement a web

based surveillance system to detect motion and automatically alert the system administrator.
The alerting may not be instant due to network downtime and may take some time before it

reaches the devices. By so doing, the email notification alert may not come at the exact moment

the intrusion took place.


CHAPTER TWO

LITERATURE REVIEW

2.1 INTRODUCTION

This chapter extensively discusses the theoretical literature involved in internet of things,

intelligent video surveillance, computer vision and internet communication principles.

2.2 REVIEW OF RELATED WORKS

A Russian Physicist, Léon Theremin developed a surveillance system in 1927 requested by the

Soviet for labour and defense purposes, the system consisted of a manually-operated scanning-

transmitting camera and wireless shortwave transmitter and receiver which was used to monitor

approaching visitors in the courtyard of the Moscow Kremlin. The earliest video surveillance

systems involved constant monitoring because there was no way to record and store information.

The development of reel-to-reel media enabled the recording of surveillance footage. These

systems required magnetic tapes to be changed manually, which was a time-consuming,

expensive and unreliable process, with the operator having to manually thread the tape from the

tape reel through the recorder onto an empty take-up reel. Due to these shortcomings, video

surveillance was not widespread.

A work by Lubos Ovsenik and Ján Turán in 2010 viewed and implemented a surveillance system

based on four independent but interacting modules: detection, tracking, classification and

recognition in order to achieve motion detection and classification or facial recognition.


2.3 WEAKNESS OF THE EXISTING SYSTEM

The current system, which is still in operation and has been for a long time, has been reviewed in

various ways and proven to have certain flaws. A number of flaws in the current system are

listed below.

1. In video surveillance, the user or security guard wants to be aware of suspicious

movement; however, current motion detection systems are not equipped to handle noise

and environmental changes such as wind-blown tree leaves, a bird flying by, a change in

weather (rainfall), and a change from day to night time, and may raise false alarms.

2. The current widespread system does not automatically detect motion and starts recording

the action taking place. The operator would have to go through hours of footage to get the

exact time the detected motion took place.

Due to the false alarm, the system will require a significant storage capacity to record the data of

the observed movements.

2.4 INTERNET OF THINGS (IOT)

The Internet of things (IoT) describes the network of physical objects – ‘things- or objects that

are embedded with sensors, software and other technologies for the purpose of connecting and

exchanging data with other devices and systems over the internet. (Rouse, 2019).

Things have evolved due to the convergence of multiple technologies like real-time analytics,

machine learning, commodity sensors, and embedded systems. Traditional fields of embedded

systems, wireless sensor networks, control systems, automation (including home and building

automation), and others all contribute to enabling the internet of things. In the consumer market,

IoT technology is most synonymous with products pertaining to the concept of the ‘smart home’,
including devices and appliances (such as, lighting fixtures, thermostats, home security systems

and cameras, and other home appliances) that support one or more common ecosystems, and can

be controlled via devices associated with that ecosystem, such as smart phones and smart

speakers. IoT can also be used in healthcare systems. (Laplante, et al 2018).

2.5 THE NEED FOR IOT IN TRADITIONAL SURVEILLANCE SYSTEMS

Surveillance is a vital utility in all places to enable the provision of secure environment for the

well-being of organized society and can be effectively achieved with the help of a video.

Industries, along with researchers are endeavouring hard to overcome the difficulties seen in the

implementation of a mature Internet of Things (IoT) framework for video surveillance

application.

There is an increasing demand for automated video surveillance with a wide range of threats in

the society and less manpower to monitor them. With traditional surveillance system, detection

of intrusion is limited to the presence of a security personnel and therefore tracking moving

image is an important task in surveillance system, since there is a continuous change in the

location of the objects. Object detection involves obtaining objects in consecutive frames and

intrusion alerting systems tracks these objects and reports back if the objects exceed the

minimum intrusion requirements (threshold).

2.6 BENEFITS OF IOT SOLUTIONS FOR SURVEILLANCE SYSTEMS

By harnessing the power of IoT for security in surveillance solutions, it enables building owners,

organization managers, and security professionals manage and control surveillance devices

remotely to monitor all aspects of a facility, make smarter decisions about the best course of

action to take based on real-time security conditions, determine when there is a false alarm
without having to physically inspect the location or unnecessarily dispatch security staff and

collect and analyse data to make important improvements to security processes and systems.

Perhaps the greatest benefit using IoT solutions for security and surveillance system is the ability

to prevent the loss of critical assets. IoT security solutions allow organizations to gain greater

visibility over who enters and leaves a facility in real-time, consistently and securely monitor

facility conditions from any location with Wi-Fi access and act quickly on important security

alerts delivered right to their mobile device.

2.7 DISADVANTAGES OF INTERNET OF THINGS

Philip N. Howard a professor and author, cautions that privacy threats are enormous, as is the

potential for social control and political manipulation (Howard, 2015). Concerns about privacy

have led many to consider the possibility that big data infrastructures such as the internet of

things and data mining are inherently incompatible with privacy (McEwan, 2019).

Also, the IoT suffers from platform fragmentation, lack of interoperability and common technical

standards (Wieland, 2016) a situation where the variety of IoT devices, in terms of both

hardware variations and differences in the software running on them, makes the task of

developing applications that work consistently between different inconsistent technology

ecosystems hard. (Rouse, 2019).

2.8 MOTION DETECTION

Motion detection is an important branch of Computer Vision research that has acquired a lot of

traction. The process of detecting a change in the location of an item in relation to its

surroundings, or a change in the surroundings in relation to an object, is known as motion

detection (Uhunmwangho, 2021). Recent advances in Computer Vision, as well as the


availability of low-cost hardware such as video cameras, have sparked a surge of interest in

identifying changes within a video and recognizing and interpreting human gestures in a video.

Many computer vision applications, such as video surveillance, traffic monitoring, and human

gesture identification, require the detection of moving objects in an image sequence. The frame

subtraction technique, the background subtraction method (which is later studied in depth), the

background estimation method, and the optical flow method are the primary methods utilized in

moving object identification at the moment (Shah et al., 2013). The objective of a motion

detector is to detect a region of interest embodied in a region of awareness, where the region of

awareness, or something comparable to the camera's focus in the field of vision, is defined as the

area being watched. The region of interest is in the area of the environment that is being

monitored for activity (Dellosa, 2014). The detection of a moving item in the scene is what

motion detection in subsequent pictures is all about.

2.8.1 MOTION DETECTION FOR VIDEO SURVEILLANCE

Moving object detection in visual surveillance is the key step, especially for foreground and

background separation. Background subtraction is subjective to foreground changes and has

better performance to each moving object, especially in object tracking. The conventional

technique of video frame difference includes the subtraction of two consecutive frames simply

followed by thresholding and analysing gradient or histogram; key points as a typical feature of

motion also have been applied to foreground and background separation. Nowadays, motion

analysis and optical flow by using information theory and deep learning have been employed to

video dynamic analysis and could get surprising results.

At the stage of object tracking, filtering (Kalman filtering, Bayesian filtering, particle filtering,

etc.) is used to predict every position of the target object. Another tracking approach uses
connected components to segment the changes into different objects without prior knowledge.

The approach exhibits a good performance when the object has a very low resolution.

Motion detection in video surveillance refers to the surveillance system's capacity to detect

motion and record it. When a security camera detects motion, it triggers a software-based

monitoring mechanism that instructs the camera to begin recording the event. This is referred to

as activity detection. The kind of motion detected by an advanced motion detection surveillance

system may be analysed to see if it merits an alarm. The goal of the Real-Time Security System

with Human Motion Detection design is to create a system to monitor an area using an IP camera

that is suited for areas where no one is allowed to access and where motion detection is required.

Apart from the obvious benefit of being able to split video streams into moving and background

components, identifying moving blobs offers a focal point for identification, classification, and

activity analysis, making these procedures more efficient because only “moving” pixels must be

evaluated. The three most common methods for detecting moving objects are temporal

differencing, background removal, and optical flow. Although temporal differencing is

extremely adaptable to dynamic settings, it performs a poor job of recovering all important

feature pixels in most cases. Background subtraction offers the most detailed feature data, but it

is very sensitive to dynamic scene changes caused by lighting and other factors. In the presence

of camera motion, optical flow may be used to identify independently moving objects; however,

most optical flow calculation methods are computationally expensive, and cannot be applied to

full-frame video streams in real-time without specialist hardware (Rahman, 2008). The goal of

the Real-Time Security System with Human Motion Detection design is to create a system to

monitor an area using a web camera that is suited for areas where no one is allowed to access and

where motion detection is required. If any object was moving, the camera was utilized to take
live photos of the area under examination, and the acquired images were saved for future use.

According to Patel et al., (2016), CCTV cameras are more expensive due to the usage of

computers in surveillance. The detection of the unlawful activity also necessitated human effort.

Over the last several years, motion detection surveillance technology has sparked a lot of

attention. Based on a review and assessment of currently available methodologies. The suggested

method is both efficient and practical for usage at home and in offices. Only when the

movements surpass a pre-determined value or threshold does the system take pictures (Charadva

et al., 2014).

2.8.2 OPERATION OF MOTION DETECTION

According to Shah et al. (2013), the frame subtraction technique, the background subtraction

method, the background estimation method, and the optical flow method are the primary

methods utilized in moving object identification at the moment. Any motion detection system

based on the approaches outlined above must be able to handle a variety of crucial

circumstances. These circumstances cause motion in parts of the scene that aren't important. If

we want to achieve a near-perfect motion detection system, we need to handle and control these

circumstances properly. These crucial situations can take various forms, including:

1. Noise in the image, due to a low-quality picture video source.

2. Small movements of non-static objects such as tree branches and bushes blowing in the

wind.

3. Variations in lighting conditions in different parts of the same object.

4. Gradual and sudden changes in the light conditions.

5. Objects that are moving so quickly that they are only caught in a single frame of the

entire scene.
Shah et al. (2013) stated that some of these scenarios need frame pre-processing, such as noise

reduction and illumination adjustments. However, it adds to the amount of processing required to

detect moving objects. The motion detection system must also be able to operate for an extended

period of time without human intervention. To do this, the system must be able to adjust to both

slow and abrupt illumination or light changes, as well as new items settling in the scene, such as

a new automobile (new object) parked in a parking lot (scene). This implies that the background

should be adaptable in terms of time. In addition, the system should filter out extraneous motion

and minor camera oscillations, such as when the camera mount shakes due to wind turbulence.

This implies that the confidence in the background value must be estimated locally.

A video or scene is made up of frames, which are a series of pictures. The camera is observing a

static view, which is captured in these frames. The illusion of motion is created by viewing these

frames at a fast pace. The frame rate of a video can range from 6 frames per second to 120 or

more frames per second. A pleasant illusion of a moving image requires a frame rate of around

16 frames per second. Because a video is made up of a series of pictures, mastering the art of

image manipulation is essential. A visual depiction of a real item is called an image. A picture, or

more specifically a Raster Image, is made up of a limited number of digital values known as

picture components or pixels. It has a set number of pixels in each row and column. Pixels are

the tiniest individual elements of a picture, containing quantized values that indicate the

brightness of a particular colour at any given instant in time. A pixel's size, which specifies how

much colour may be shown, can range from 8 bits to 64 bits. Each row and column have a fixed

number of pixels. Pixels are the tiniest individual parts in an image, containing quantized values

that represent the brightness of a specific colour at any given time. The size of a pixel, which

determines how much colour may be shown, can range from 8 to 64 bits (Shah et al., 2013).
2.9 BENEFITS OF USING MOTION DETECTION FOR VIDEO SURVEILLANCE

The detection is essentially triggered by comparing successive images and evaluating if the

change between them represents motion. If there are substantial changes between two successive

images, the cameras will "deduce" that there has been motion inside the monitored region. With

this function, the user may set up a series of events, such as starting the recording and sending

email notifications, when the camera detects motion/movement in the monitoring area.

According to (Advantages of Motion Detection CCTV Cameras, 2019) these are some key

benefits of using motion detection cameras:

1. Speeds up the Process of Post Investigation

With the aid of a motion detection camera, you may set the system to only capture film when

there are movements detected. This will save time while analysing footage because recordings

only include the time windows when incidents occur.

2. Increased Recording Period

You will be able to extend the recording time on your recorder by using motion detection

recording. This is due to the fact that recordings are only made when there is movement and not

continually 24 hours a day, seven days a week. This is one of the primary reasons why so many

clients are interested in motion detection cameras.

3. Enhances Security

With the motion detection function, you may set up email notifications whenever motion is

detected in a pre-defined limited region. This will send you messages when the cameras detect
movement, allowing you to be more proactive in protecting your property. It is also possible to

integrate motion detection cameras with third-party devices.

2.10 INTELLIGENT VIDEO SURVEILLANCE

Intelligent surveillance has become an essential and practical means for security which combines

computer science and engineering with multidisciplinary studies including data repository,

computer vision, digital image processing, computer graphics as well as computational

intelligence.

Video surveillance and the IoT are converged for ensuring compactness for the nodes of video

surveillance, ease of time, and high efficiency, and for providing video surveillance over Internet

of Things (VS-IoT). There is an increasing demand for automated video surveillance with a wide

range of threats in the society and less manpower to monitor them. Especially, detecting violence

in crowded scenes is challenging because of the rapid movement, overlapping features due to

occlusion, and cluttered backgrounds. Different from traditional monitoring, scenes related to

security concerns are possible to be monitored automatically and remotely with assistance of

intelligent surveillance equipped.

2.11 COMPUTER VISION

Computer vision is an interdisciplinary scientific field that deals with how computers can gain

high-level understanding from digital images or videos. From the perspective of engineering, it

seeks to understand and automate tasks that the human visual system can do.

Computer vision tasks include methods for acquiring, processing, analysing and understanding

digital images, and extraction of high-dimensional data from the real world in order to produce

numerical or symbolic information, e.g. in the forms of decisions. Understanding in this context
means the transformation of visual images (the input of the retina) into descriptions of the world

that make sense to thought processes and can elicit appropriate action. This image understanding

can be seen as the disentangling of symbolic information from image data using models

constructed with the aid of geometry, physics, statistics, and learning theory.

The scientific discipline of computer vision is concerned with the theory behind artificial

systems that extract information from images. The image data can take many forms, such as

video sequences, views from multiple cameras, multi-dimensional data from a 3D scanner, or

medical scanning device. The technological discipline of computer vision seeks to apply its

theories and models to the construction of computer vision systems.

Sub-domains of computer vision include scene reconstruction, object detection, event detection,

video tracking, object recognition, 3D pose estimation, learning, indexing, motion estimation,

visual servoing, 3D scene modelling, and image restoration (Morris, 2014).

2.12 INTERNET COMMUNICATION PRINCIPLES

The Internet (or internet) is the global system of interconnected computer networks that uses the

Internet protocol suite (TCP/IP) to communicate between networks and devices. With the

internet, we can monitor, receive and send information and data remotely. There are various

protocols in place in order for the internet to be possible.


2.12.1 INTERNET PROTOCOL SUITE (TCP/IP)

The Internet protocol suite is the conceptual model and set of communications protocols used in

the internet and similar computer networks. It is commonly known as TCP/IP because the

foundational protocols in the suite are the Transmission Control Protocol (TCP) and the Internet

Protocol (IP). The Internet protocol suite provides end-to-end data communication specifying

how data should be packetized, addressed, transmitted, routed, and received

2.12.2 IP ADDRESS

An Internet Protocol address (IP address) is a numerical label assigned to each device connected

to a computer network that uses the Internet Protocol for communication (Postel, 1981). An IP

address serves two main functions: host or network interface identification and location

addressing.

2.12.3 SUBNETTING

The practice of dividing a network into two or more networks is called subnetting. Similarly, a

subnet mask is a 32-bit number created by setting host bits to 0s and setting network bits to 1s.

The main function of the subnet mask is to determine the network and host part of a network

from the IP address.

2.12.4 TRANSMISSION CONTROL PROTOCOL (TCP)

The Transmission Control Protocol (TCP) is one of the main protocols of the Internet protocol

suite. It originated in the initial network implementation in which it complemented the Internet

Protocol (IP). Therefore, the entire suite is commonly referred to as TCP/IP. TCP provides
reliable, ordered, and error-checked delivery of a stream of octets (bytes) between applications

running on hosts communicating via an IP network. Major internet applications such as the

World Wide Web, email, remote administration, and file transfer rely on TCP, which is part of

the Transport Layer of the TCP/IP suite. SSL/TLS often runs on top of TCP.

TCP is connection-oriented, and a connection between client and server is established before

data can be sent. The server must be listening (passive open) for connection requests from clients

before a connection is established. Three-way handshake (active open), retransmission, and

error-detection adds to reliability but lengthens latency. Applications that do not require reliable

data stream service may use the User Datagram Protocol (UDP), which provides a

connectionless datagram service that prioritizes time over reliability. TCP employs network

congestion avoidance. However, there are vulnerabilities to TCP including denial of service,

connection hijacking, TCP veto, and reset attack.

2.13 DEFINITION OF TERMS

OpenCV: (Open Source Computer Vision Library) is a software library for computer vision and

machine learning that is free and open source. OpenCV was created to offer a standard

foundation for computer vision applications and to speed up the incorporation of machine

perception into commercial goods.

Computer Vision: Computer vision combines cameras, edge- or cloud-based computing,

software, and artificial intelligence (AI) to enable systems to “see” and identify objects.

Threshold: Threshold determines how much motion is required to trigger an event. If the

amount of motion exceeds the threshold, an event occurs.


Noise: Noise is the unwanted electromagnetic energy that interferes with the ability of the

receiver to detect the wanted signal.

Current Frame: The frame that determines if motion has been or will be detected or not.

Background Frame: The initial frame without any object or movement.

Pixel: A minute area of illumination on a display screen, one of many from which an image is

composed.

Power over Ethernet (PoE): Power over Ethernet, or PoE, describes any of several standards

that pass electric power along with data on twisted-pair Ethernet cabling. This allows a single

cable to provide both data connection and electric power to devices such as wireless access

points (WAPs), Internet Protocol (IP) cameras, and voice over Internet Protocol (VoIP) phones.

2.14 SUMMARY OF LITERATURE REVIEW

This chapter briefly covered video surveillance and motion detection to explain how motion

detection and video surveillance operate together. Motion detection and video surveillance are

inextricably linked because adding motion detection into surveillance may increase security and

reduce crime. Various methods of motion detection, such as temporal difference, optical flow,

and background subtraction. This chapter concludes by highlighting the advantages of employing

a motion detection surveillance system and an explained on computer vision and necessary

internet protocols.
CHAPTER THREE

METHODOLOGY

3.1 INTRODUCTION

This chapter discusses the process of developing the research methodologies needed to complete

the system. This chapter will go many steps of developing the present study’s methodology in

detail.

The goal of this research project is to secure a facility to be able to detect motion and alert the

facility owner/ manager when motion is detected. The motion detection surveillance system

(MDSS) automatically alerts the user when motion is detected in the area without any human

intervention. It also automatically starts recording once motion has been detected so that the user

can download and watch the action that took place. The alerting medium used here is via SMS or

email with the ability of remote access via any internet connected device.

Figure 3.1: Architectural Diagram for the System.


3.2 DESIGN OF THE PROPOSED SYSTEM

The design of this system is a combination of electrical hardware and software applications all

for the goal of achieving an accurate and more efficient motion detection system. This system is

for organizations, individuals as well as corporations that need to have an effective and

automated security system in place at a lower cost.

3.3 SYSTEM ANALYSIS

The project, development of office surveillance and alerting is to ensure higher safety and anti-

burglary protection in offices. This research operates with two sections, which are:

1. Hardware (equipment).

2. Software.

3.3.1 HARDWARE (EQUIPMENT)

The hardware components involved includes: one IP camera, one router, one base PC (windows

OS preferably). The IP camera is mounted and installed in a way that it overlooks the area under

surveillance which, for the purposes of this research, is an office.

3.3.2 EQUIPMENT AND SETUP

The equipment used as well as the procedural setup are outlined in the diagram below. The setup

and installation procedure are also discussed.

Put the diagram you are referring to here

3.3.3 PACKAGE CONTENTS

1. PoE Adapter (12V, 2A) with


2. Mounting bracket

3. HikVision Camera (Model: DS-2CD1323G0E-I)

4. Quick Start Guide

5. Router

3.4 HARDWARE INSTALLATION

The procedure for the hardware installation is simple and straightforward. Below are the steps to

get the hardware installation done.

1. Connect the PoE adapter (discussed below).

2. Turn on the camera by switching on the power supply.

3. Verify the camera is connected to the network by doing a ping test to the default IP

(192.168.1.64)

4. Visit the network camera via its default IP address: 192.168.1.64

5. Click OK for finish activation

Note: for the network camera which enables the DHCP by default, you need to activate network

camera via SADP software and search the IP address.

3.4.1 CONNECTING TO THE POE ADAPTER

Below are the steps to connect the PoE adapter.

1. Connect the Ethernet cable from the device to the PoE port of the PoE Adapter.

2. Connect an Ethernet cable from your LAN to the LAN port of the PoE Adapter.

3. Connect the power cord tot eh adapter’s power port. Connect the other end of the Power

Cord to the power outlet


3.4.2 ACTIVATION VIA SADP SOFTWARE

SADP (Search Active Devices Protocol) software is used for detecting the online device,

activating the camera, and resetting the password. Get the SADP software from the supplied disk

or the official website (hikvision.com), and install the SADP according to the prompts.

Follow the steps to activate the camera.

1. Run the SADP software to search the online devices.

2. Check the device status from the device list, and select the inactive device.

Plate 3.1: Detecting the IP Camera via SADP software

3. Create and input the new password in the password field, and confirm the password

(username: admin, password: 12345678).

4. Click activate to start and complete the activation.

Plate 3.2: Activating the IP camera via the SADP software


3.5 DEVICE SPECIFICATIONS

This details the minimum required specifications needed to replicate system operation and the

specifications of the electrical equipment’s used to achieve the existing system.

3.5.1 IP CAMERA TECHNICAL SPECIFICATIONS

Plate 3.3: HikVision IP Camera

Name: HikVision Camera

Model: DS-2CD1323G0E-I
CAMERA

Image Sensor 1/2.7" Progressive Scan CMOS

Min. Illumination Colour: 0.01 Lux @(F2.0, AGC ON), B/W: 0 Lux with IR

Max. Resolution 1920 × 1080

Shutter Time 1/3 s to 1/100, 000 s

Day & Night IR Cut filter

Angle Adjustment Pan: 0° to 360°, tilt: 0° to 75°, rotation: 0° to 360°

LENS

2.8 mm, horizontal FOV 112.1°, vertical FOV 60.0°, diagonal


FOV 132.2°
Focal Length and FOV (Field 4 mm, horizontal FOV 90.2°, vertical FOV 48.6°, diagonal
of View) FOV 107.6°

Lens Mount M12

Iris Type Fixed

Aperture F2.0
NETWORK

TCP/IP, ICMP, HTTP, HTTPS, FTP, DHCP, DNS, DDNS,


RTP, RTSP, RTCP, NTP, UPnP™, SMTP, IGMP, 802.1X,
Protocols QoS, IPv6, Bonjour, IPv4, UDP, SSL/TLS

API Open Network Video Interface, ISAPI

User/Host Up to 32 users. 3 levels: administrator, operator and user

Client iVMS-4200, Hik-Connect

Plug-in required live view: IE 10+


Plug-in free live view: Chrome 57.0+, Firefox 52.0+
Web Browser Local service: Chrome 57.0+, Firefox 52.0+
3.5.2 ROUTER TECHNICAL SPECIFICATIONS

Plate 3.4: TP-link router

Hardware features

Interface 1 USB 2.0 Port for


LTE/HSPA+/HSUPA/HSDPA/UMTS/EVDO
USB Modem
1 10/100Mbps WAN Port, 4 10/100Mbps
LAN Ports, support the auto-Negotiation and
auto-MDI/MDIX
Button WPS/Reset Button
Wireless On/Off Switch
Power On/Off Button
External Power Supply 12VDC/1A
Dimensions ( W x D x H ) 8*5.4*1.7 in. (204*138*44 mm)
Antenna Type Omni directional, Detachable, Reverse SMA
Antenna Gain 2x5dBi

Wireless Features

Wireless Standards IEEE 802.11b, IEEE 802.11g, IEEE 802.11n


Frequency 2.4-2.4835GHz
Transmit Power <20dBm
Wireless Security Support 64/128 bit WEP, WPA-PSK/WPA2-
PSK,
Wireless MAC Filtering

Software features

Security NAT Firewall, SPI Firewall, MAC / IP /


Packet / Application / URL Filtering, Denial
of Service(DoS), SYN Flooding, Ping of
Death
Management Web Based Configuration(HTTP), Web
Based Firmware Upgrade

Others

Certification CE, FCC, RoHS


Package contents 3G/4G Wireless N Router TL-MR3420
2 Antennas
Power supply unit
Ethernet Cable
Resource CD
Quick Installation Guide
System Requirements Microsoft® Windows® 98SE, NT, 2000, XP,
Vista™ Windows 7, 8, 10, MAC® OS,
NetWare®, UNIX® or Linux.
Environment Operating Temperature: 0℃~40℃
(32℉~104℉)
Storage Temperature: -40℃~70℃ (-
40℉~158℉)
Operating Humidity: 10%~90% non-
condensing
Storage Humidity: 5%~90% non-condensing
3.6 SOFTWARE

This section discusses the applications and design languages used in the development of a new

system, as well as the model and structural design of the major modules, functions, and feature

integration utilizing a variety of terms.

All designs and decisions are made with the following four essential considerations in mind:

1. Clarity and ease of use

2. Build ability.

3. Flexibility.

4. Scalability (ability to add more devices/functions).

This project was designed and implemented using the python flask framework for its

compatibility with the OpenCV (computer vision) library with some other development language

like HTML5 to produce plain text and picture files and Bootstrap for frontend and some static

files, JavaScript for client-side validation. AgentUI was also used to assist with the front end and

motion detection capabilities. These applications after compilation are tested using a personnel

computer or laptop with windows, Linux, Mac etc. and run on a browser.

For their outstanding approach, the following were utilized:

1. Python programming language was used to create python scripts that added functionality

to webpages that HTML alone couldn't provide and interact with the web server (Apache

etc).

2. OpenCV was used to build the motion detection algorithm with computer vision
3. HTML was chosen since it is a standard authoring language for creating web pages. Each

page has a large number of HTML labels, including hyperlinks, that are used to link to

other sites.

4. AgentUI library was also used to assist the frontend and motion detection algorithm.

3.7 MOTION DETECTION ALGORITHM

Detailed below, are the steps the algorithm takes to determine whether motion occurred from a

received frame. The code for this was written in python and it is attached to the appendix of this

research. The approach use is known as background subtraction approach and it is explained

below.

3.7.1 MOTION DETECTION USING BACKGROUND SUBTRACTION APPROACH

Figure 3.2: Motion Detection Block Diagram

The basic idea behind this approach is to create a model of the static scene (i.e., without moving

objects) called background, and then compare every frame of the series to this backdrop to

distinguish the regions of motion termed foreground (the moving objects). Figure 2.4 shows a

procedural view of how this technique works. This method necessitates image modification in

order to distinguish the foreground from the background. In general, the modifications listed

below are necessary. Assume we have two images, X and Y, and we are altering them to get

image Z (Shah et al., 2013).


Figure 3.3: Computer Vision using Background Subtraction Source: OpenCV docs

(https://docs.opencv.org/4.5.1/d1/dc5/tutorial_background_subtraction.html)

1. Difference

The difference of two images of the same size and pixel format yields an image in which each

pixel represents the absolute difference between the corresponding pixels in the given images.

For each pixel (x) in Image Z:

red = │ X.getPixel(x).R - Y.getPixel(x).R │

green = │ X.getPixel(x).G - Y.getPixel(x).G │

blue = │ X.getPixel(x).B - Y.getPixel(x).B │

Z.setPixel(x) = Color(red, green, blue)

The reason for not using 32bpp pictures is because if alpha channel images are used, the

presentation of the final image may appear a bit surprising - possibly nothing will be visible (if

image is presented according to its alpha channel). The reason for this is that after differencing,
the whole alpha channel will be zeroed (zero difference between alpha channels), resulting in a

completely transparent image.

2. Threshold

It binarizes images based on a threshold value that is given. All pixels whose intensities are equal

to or greater than the threshold value is transformed to white pixels. Everything else pixels with

intensities less than the threshold value are ignored.pixels were changed to black pixels.

For each pixel (x) in Image Z:

If X.getPixel(x).Intensity > threshold

Z.setPixel(x) = White

Else

Z.setPixel(x) = Black

We have the following images: -

Background Frame – A grayscale image of the first image of the scene\video.

Current Frame – A grayscale image of the current frame of the scene.

Threshold – The threshold that determine whether the movement is motion or not.

Then we apply the following steps:

1. We Calculate the Difference between the Background Frame and the Current Frame.

For each pixel (x)

I(x) -> │ backgroundFrame(x) – currentFrame(x) │


The resulting image is one in which all pixels with the same values (i.e. pixels that do not

change) are wiped out and all pixels that change (i.e. regions of motion) are highlighted. The

process does not stop here; the finished image will include both relevant and irrelevant areas of

motion. We must now select those out.

2. Using the threshold value as a Threshold for the image calculated in (1), we filter the areas of

motion.

For each pixel(x)

If I(x) > threshold

I(x) -> White

Else

I(x) -> Black

We may filter out and exclude irrelevant areas, such as tree leaf movement in the wind, by

setting a suitable threshold value.

3. The Current Frame is then highlighted in the resulting image from (2) to identify regions

of motion.

4. The final step is to change the background. This is accomplished by a defined amount of

movement of the background to the current frame. This approach becomes frame

subtraction if we change our background with the current Frame.

Updating the background is generally accomplished by warping it slightly toward the current

Frame. The simplest method of morphing is to combine the two pictures by extracting a
percentage of the pixels' intensities from the first image and the remainder from the second.

The percentage value for the background is set at 0.75.

For each pixel(x) in Image Z

Z.setPixel(x) = 0.75 * background.getPixel(x) + (1 - .75) * currentFrame.getPixel(x)

Figure 3.4: Background Subtraction Process Source: Shah et al., 2013


3.8 USE CASE DIAGRAM OF THE SYSTEM

Figure 3.5: Use Case Diagram of the system

The diagram above graphically depicts a user’s possible interactions with the web-based IP-

CAM surveillance system. It shows the various use cases and different types of users the system

has. The user is not only restricted to the physical human but also the electrical equipment’s

involved in the system like the server, and the motion detection engine.
3.9 OVERALL MODEL OF THE SYSTEM

Figure 3.6: Overall Model of the system Source: Khan, 2011

This shows how the hardware equipment’s are interconnected with each other in the network.

The intruder interacts with the capture video device (IP Camera) with triggers the motion

detection algorithm installed on the MDSS server. The client are the web-based medium where

the client can view recordings and snapshots on the intruder. The database holds sensitive

information’s about the system like user login details and system log information.
3.10 SEQUENCE DIAGRAM OF THE SYSTEM

Figure 3.7: Sequence Diagram of the System

This sequence diagram shows object interactions arranged in a time sequence for the system. It

depicts the objects involved in the scenario and the sequence of messages exchanged between the

objects needed to carry out the functionality of the scenario.

From the diagram above, the user interface is responsible for turning on and off the IP Camera

feed. The IP Camera grabs each frame which is then analyse by the motion detection algorithm

to determine whether motion occurred. If there is motion, it starts the alarm and sends out a SMS

to the registered phone or email and also starts recording.

3.11 CLASS DIAGRAM OF THE SYSTEM


Figure 3.8: Class Diagram of the System

The diagram above is the class diagram for the developed system which describes the structure

of a system by showing the system’s classes, their attributes, operations (or methods) as well as

the relationships among other objects.

Similar to the sequence diagram, the camera interacts with the frame grabber which in turn

interacts with the motion detector object that analyses the frames captured. The result of the

analysis by the algorithm will determine whether to send alerts, SMS and/or email as well as

start a video recording of the intruder actions.

CHAPTER FOUR
IMPLEMENTATION AND TESTING

4.1 SYSTEM IMPLEMENTATION

In this section, we discuss the steps to implement and test the developed system. System
components were purchased, the hardware were installed, and the software developed was
loaded and the localhost setup. The element is built with acceptable technology and industry
practices. This procedure connects the system definition and integration phases. This program
requires the following tools to be implemented: Python, HTML, and so on. This set of tools is
used in tandem to produce the code that is run on the local machine (127.0.0.1:3000), resulting in
the application system.

The HikVision IP camera was subjected to a ping test to ascertain the device was reachable and

communicating in the network. It is also important to note, the IP camera comes with a default IP

(192.168.1.64). After activation, the IP address will need to be changed to correspond with the

same subnet mask for the IP address of the router or computer.

AgentUI works on .NET framework 4.7+ which provides the database and localhost capabilities

as well as providing services like thread management, garbage collection, type-safety, exception

handling, and more.

Below are the steps to implement the developed system.

Step 1: Obtain the parts and set up the hardware

One IP Camera, one router, one laptop, extension boxes, and PoE adapters, etc.

The processes and activities carried out in designing the system is presented pictorially below.

Work station/Test bed:


Plate 4.1: Workstation of the system

Step 2: Mount the IP camera in such a way that it overlooks the area under surveillance

especially hotspot areas (points where motion is likely to take place, for example door entrances,

windows, etc.)

Mounting instructions and steps can be found in the Quick Start Guide that comes in the package

content.

Step 3: Install the necessary software onto the system and start up the software.

Note: Software for Windows runs on Windows 7 SP1+. Requires the .NET framework v4.7+.

Step 4: Signup/login to gain access to the feed and intruder recordings.


Plate 4.2: Login Interface

Step 5: Once access has been granted, add the camera.

Note: As mentioned in chapter 3, make sure both the laptop and IP Camera are both connected to

the same router. This creates a network making it possible for the laptop and camera to

communicate. Once the IP Camera is connected, an IP will be displayed with will be entered into

the settings on the software. In this case, IP: 192.160.1.101.

Plate 4.3: Adding the IP Camera to the software


Plate 4.4: User interface of the software streaming the IP Camera

Step 6: Set up the detector and alert system. Enter the desired email address to send alert

notifications.

Plate 4.5: Setting up the alerting system

The code snippet is included in the appendix.

Step 7: Move into frame to trigger the detection and check email after few seconds.
Plate 4.6: Triggering the motion detector

Plate 4.7: Received email notification of detected motion.

Step 8: Log back into the software to access the recordings of the motion detected.

Plate 4.8: Recordings automatically taken by the system


4.2 SYSTEM TESTING

System testing is performed on an entire integrated system to assess the system's conformance

with its stated objectives. System testing is done on the complete system in the context of either

functional or system requirement specifications, or both. System testing examines not just the

design, but also the behavior and even the customer's perceived expectations. It is also meant to

test up to and above the limits stated in the software or hardware requirements specification(s).

This testing was performed to guarantee that the system satisfies the needs of the business and

the end users.

4.3 TEST RESULT

Test results are the end result of the entire software testing life cycle procedure. The resulting

findings provide insight into the deliverables of a software project, which is important in

reporting the project's status to stakeholders.

4.3.1 HARDWARE TEST RESULT

This describes the test carried out on the network to ascertain the devices (ip camera, router and

pc) where all communicating and able to receive packets.


4.3.1.1 PING TEST ON THE IP CAMERA

Plate 4.9: Result of the ping test.

Plate 4.10: Default IP and subnet mask

The above figure indicates that after the network camera is connected, it is reachable on the

network by pinging the initial default IP address of the network camera (192.168.1.64).
4.3.1.2 NETWORK PERFORMANCE TEST

Network performance refers to the measures of service quality of a network as seen by the

customer.

Using JPerf to test network performance

JPerf stands for Java Perf which is the GUI version of iPerf. IPerf is an open source tool for

network performance measurement and tuning. It is a cross-platform tool that can produce

standardized performance measurements for any network.

Setting up test suite (windows)

Step 1: Download Jperf (https://sourceforge.net/projects/iperf/files/). Unzip the file and double

click the bat file to open up the software.

Step 2: You need two hosts that will send and receive traffic which is known as the client and

server respectively. First, you have to start the JPerf server in order to listen for incoming traffic.

Click on server option, choose a port to listen to and the click ‘Run iPerf’ icon.

Plate 4.11: Starting up JPerf server


Step 3: Now that the JPerf server is listening, open JPerf on the client computer and select the

client option. Input the IP and port of the JPerf server (IP: 192.168.1.178, Port: 5001). Incase you

are not sure of the IP, start up the command prompt and type ‘ipconfig’.

Plate 4.12: Getting the server IP from the command prompt

The software should start reading the outputting results in real-time.

Plate 4.13: Network performance result.


NETWORK PERFORMANCE TEST RESULT

a. Without streaming: The test was first run when the IP Camera isn’t streaming to the

software and the network performance was studied on the server and client side. The

result are as follows:

Server side:

Table 4.1: Network performance result on the server side with no stream

Interval (secs) Transfer (KBytes) Bandwidth (Kbits/sec)


1 151136 1238106
2 108152 885981
3 139448 1142358
4 152456 1248920
5 135544 1110376
6 146848 1202979
7 118568 971309
8 143536 1175847
9 122848 1006371
10 136288 1116471

Figure 4.1: Server network performance without stream


Client side:

Table 4.2: Network performance result on the client side with no stream

Interval (secs) Transfer (KBytes) Bandwidth (Kbits/sec)


1 151216 1238761
2 108080 885391
3 139496 1142751
4 152480 1249116
5 1354961 1109983
6 146816 1202717
7 118568 971309
8 143616 1176502
9 122776 1005781
10 136352 1116996

Figure 4.2: Client network performance without stream

b. With stream: Network performance when the IP camera is streaming. The results are as

follows.
Server side:

Table 4.3: Network performance on server side with stream

Interval (secs) Transfer (KBytes) Bandwidth (Kbits/sec)


1 89488 733086
2 87592 717554
3 101352 830276
4 102856 842596
5 85232 698221
6 96944 794165
7 98976 810811
8 94560 774636
9 79344 649986
10 93768 768147

Figure 4.3: Server network performance on stream

Client side:

Table 4.4: Network performance on client side with stream

Interval (secs) Transfer (KBytes) Bandwidth (Kbits/sec)


1 89552 733610
2 87552 717226
3 101328 830769
4 102856 842596
5 85264 698483
6 96912 793903
7 98976 810811
8 94560 774636
9 79704 652935
10 93408 765198

Figure 4.4: Client network performance with stream

The test results above reveals that the system has a maximum network bandwidth when no

streaming is taking place of 249116 Kbits/sec on the client and 1248920 Kbits/sec on the server,

while the maximum network bandwidth when streaming is taking place is 842596 Kbits/sec on

the client and 842596 Kbits/sec on the server. This validates that the network is in fact functional

and no bandwidth leakage from redundant network usage is taking place.

4.3.2 SOFTWARE BEHAVIOURAL TEST RESULT

In order to ensure the software meets the objectives and performs as expected, behavioural test

was carried out. The aim of the behavioural test is to ensure the features implemented performs

as expected.
Table 4.5: Comparison between expected and actual results

TEST CONDUCTED EXPECTED RESULT ACTUAL RESULT

Users’ login to the Users will be navigated to the The main menu with direction

system to setup security dashboard where the main menu is modules on how to setup the

camera. displayed. camera was displayed.

User sets up security Upon configuring the camera with The camera was able to detect

camera to detect motion the appropriate settings, the camera motion and this was indicated by

should detect motion when it senses drawing a rectangular box

movement. around the area of motion.

User receives a An alarm should sound and an email When motion was detected, an

notification when notification should be sent to the user alarm was raised and an email

motion is detected when motion is detected notification was sent to the user
4.4: BILL OF ENGINEERING MEASUREMENT AND EVALUATION

The components and their relative cost are shown in the table below. The total would give an

estimated total cost of the project work.

Table 4.6: Bill of Engineering Measurement and Evaluation

S/N ITEM UNIT PRICE (₦) QUANTITY AMOUNT (₦)

1 HikVision IP Camera 40000 1 40000

2 Router 15000 1 15000

3 Network cable (CAT6, 5M) 2500 2 5000

4 Power pack 8000 1 8000

TOTAL 68000
CHAPTER FIVE

RECOMMENDATION AND CONCLUSION

5.1 SUMMARY

This research work provides an approach to security surveillance system by incorporating motion

detection. This project is a web based application using AgentUI and Python Opencv with the

background subtraction approach capable of detecting motion and eliminating environmental

noise, when motion is detected it will trigger an alarm and send an email notification to alert the

user of any suspicious activity.

5.2 CONCLUSION

When a motion detection algorithm detects an intruder, the designed motion detection alarm and

security system responds quickly. The method described above was capable of determining near-

exact points of motion. The threshold value played an important part in categorizing relevant and

irrelevant motion. Internet of things have given us the ability to network physical objects

embedded with sensors, software, etc. in order to exchange data and automatically take actions.

5.3 RECOMMENDATIONS

Motion detection in security surveillance system is a very young and developing area. The

opportunity is enormous, and there is so much to be done. This research successfully opens the

door for individuals to investigate the potentials concealed inside it. It has piqued the curiosity of

forensic scientists in recent years. This work can also be further improved by adding face

recognition to further enhance security and also being able to intelligently detect situations of

false alarm accurately. It could also be adapted to a large scale system and outdoor conditions.
REFERENCES

Advantages of Motion Detection CCTV Cameras. (2019, April 13). VIN Services & Solutions.
https://www.vin-services.com/guide/advantages-of-motion-detection-cctv-cameras

Atif K. (2011). A Motion Detection Based Surveillance System (MDSS). ResearchGate.


https://www.researchgate.net/figure/Fire-and-smoke-detection-modules-
structure_fig1_258837137/, pp. 4

Ashton, K. (2009). That 'Internet of Things' Thing. www.rfidjournal.com/articles/view?4986


Charadva, M. J., Sejpal, R. V., & Sarwade, N. P. (2014). A Study of Motion Detection Method
for Smart Home System. International Journal of Innovative Research in Advanced
Engineering (IJIRAE), 1(5).
https://www.academia.edu/11315125/IJIRAE_A_Study_of_Motion_Detection_Method_f
or_Smart_Home_System

Dave Evans (2011). "The Internet of Things: How the Next Evolution of the Internet Is
Changing Everything". CISCO White Paper.
https://www.cisco.com/c/dam/en_us/about/ac79/docs/innov/IoT_IBSG_0411FINAL.pdf
Dellosa, R. (2014). Development of an Anti-Theft Device using Motion Detection and Body
Temperature. Asia Pacific Journal of Multidisciplinary Research, 2(6).
http://www.apjmr.com/wp-content/uploads/2014/12/APJMR-2014-2-158-Revised-
Development-of-an-Anti-theft-device-using-motion-detection-system.pdf

Forsyth, David; Ponce, Jean (2012). Computer vision: a modern approach. Pearson.
Hossain, M. S., Hassan, M. M/, Al Qurishi, M., & Alghamdi, A. (2012). Resource allocation for

service composition in cloud-based video surveillance platform. In Multimedia and Expo

Workshops (ICMEW), pp. 408-412.

Howard, Philip N. (2015). The Internet of Things is Posed to Change Democracy Itself.

Politico.
Iyapo, K. O., Fasunla, O. M., Egbuwalo, S. A., Akinbobola, A. J., & Oni, O. T. (2018). DESIGN
AND IMPLEMENTATION OF MOTION DETECTION ALARM AND SECURITY
SYSTEM. International Journal of Engineering and Advanced Technology Studies, 6(1),
26–38. https://www.eajournals.org/wp-content/uploads/Design-and-Implementation-of-
Motion-Detection-Alarm-and-Security-System.pdf
Laplante, Phillip A.; Kassab, Mohamad; Laplante, Nancy L.; Voas, Jeffrey M. (2018). Building

Caring Healthcare Systems in the Internet of Things. IEEE Systems Journal. 12 (3).

McEwan, Adrian (2014). Designing the Internet of Things (PDF).

Wieland, Ken (25 February 2016). IoT experts fret over fragmentation. Mobile World.

Norris, C., Moran, J., & Armstrong, G. (Eds). (1998). Surveillance, closed circuit television and

social control. pp. 255-257.

Patel, P. B., Choksi, V. M., Jadhav, S., & Potdar, M. (2016). Smart Motion Detection System
using Raspberry Pi. International Journal of Applied Information Systems, 10(5), 37–40.
https://doi.org/10.5120/ijais2016451506
Rahman, M. J. (2008, November). Motion Detection for Video Surveillance (Master Thesis
E3651D). Högskolan Dalarn University.
http://du.diva-portal.org/smash/get/diva2:518464/FULLTEXT01.pdf
Raji, R.S. (1994). Smart networks for control. IEEE Spectrum. Available at:

https://ieeexplore.ieee.org/document/284793

Rob Mayell (2006). Simple circuit design tutorial for PoE applications. EDN.

https://www.edn.com/simple-circuit-design-tutorial-for-poe-applications/

Rouse, Margaret (2019). Internet of things (IoT). IOT Agenda.

Stallings, William (2016). Foundations of modern networking : SDN, NFV, QoE, IoT, and

Cloud. Available at: https://www.worldcat.org/oclc/927715441

Shah, S., Adhikari, V., & Pokhriyal, V. (2013). Motion detection algorithm based on
Background Subtraction. International Journal of Scientific & Engineering Research,
4(8). https://www.ijser.org/researchpaper/Motion-detection-algorithm-based-on-
Background-Subtraction.pdf
Tim Morris (2004). Computer Vision and Image Processing. Palgrave Macmillan.

ISBN 978-0-333-99451-1.

Uhunmwangho Victory (2021). Video surveillance using motion detection. BIU Faculty of

Science.

Wikipedia contributors. (2021). IP address. Wikipedia. https://en.wikipedia.org/wiki/IP_address

Wikipedia contributors. (2021). Transmission Control Protocol. Wikipedia.

https://en.wikipedia.org/wiki/Transmission_Control_Protocol

J. Postel, ed. (September 1981). Internet Protocol, DARPA Internet Program Protocol

Specification. IETF. https://datatracker.ietf.org/doc/html/rfc791

Yan, W. Q. (2019). Introduction to Intelligent Surveillance: Surveillance Data Capture,

Transmission, and Analytics (3rd ed. 2019 ed.). Springer.

APPENDIX A

MOTION DETECTION CODE AND EMAIL NOTIFICATION CODE


Code to Detect Motion
class SingleMotionDetector:
def __init__(self, accumWeight=0.5):
# store the accumulated weight factor
self.accumWeight = accumWeight

# initialize the background model


self.bg = None
def update(self, image):
# if the background model is None, initialize it
if self.bg is None:
self.bg = image.copy().astype("float")
return
# update the background model by accumulating the weighted
# average
cv2.accumulateWeighted(image, self.bg, self.accumWeight)
def detect(self, image, tVal=25):
# compute the absolute difference between the background model
# and the image passed in, then threshold the delta image
delta = cv2.absdiff(self.bg.astype("uint8"), image)
thresh = cv2.threshold(delta, tVal, 255, cv2.THRESH_BINARY)[1]
# perform a series of erosions and dilations to remove small
# blobs
thresh = cv2.erode(thresh, None, iterations=2)
thresh = cv2.dilate(thresh, None, iterations=2

Code to send Email

import smtplib
gmail_user = 'your_email@gmail.com'
gmail_password = 'your_password'
sent_from = gmail_user
to = ['person_a@gmail.com', 'person_b@gmail.com']
subject = 'Lorem ipsum dolor sit amet'
body = 'consectetur adipiscing elit'

email_text = """\
From: %s
To: %s
Subject: %s

%s
""" % (sent_from, ", ".join(to), subject, body)
try:
smtp_server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
smtp_server.ehlo()
smtp_server.login(gmail_user, gmail_password)
smtp_server.sendmail(sent_from, to, email_text)
smtp_server.close()
print ("Email sent successfully!")
except Exception as ex:
print ("Something went wrong….",ex)

You might also like