Motion detection plays an important role in intruder detection systems. Currently existing systems make use of pre-fabricated and non modifiable hardware for these purposes. This paper analyses an alternative solution where motion detection on video input is performed by means of user written software. The software is implemented using methods included in OpenCV library.
Introduction
I. INTRODUCTION
In the modern era, security and surveillance are important issues. Recent acts of theft have highlighted the urgent need for efficient video surveillance and on-the-spot notification of ongoing thefts to house owners. A number of surveillance solutions are currently available on the market for the populace, such as CCTV cameras and digital video recorders (DVRs) that can record the unauthorized activities of a trespasser, however they demand excessive amounts of investment in terms of funds and time and cannot distinguish between authorised and non-authorised users in most cases. Also the commonly available systems are often targeted towards medium sized franchises and are out of reach of common people. The task of face detection and the recognition of an intruder become very difficult when the intruder hides their face partially or fully. Hence the following system makes use of a program to perform motion detection by analyzing the relative differences between two consecutive frames. To facilitate this process the frames are further processed using the various image processing methods for ensuring the highest possible precision while distinguishing genuine motion from ‘noise’ disturbances.
.A. Different Image Processing Methods
The image processing methods from OpenCV2 library were used to process and detect motion by using the video feed:-
cv2.absdiff:This is a function which allows us to get the absolute difference between the pixels of two image arrays. By using this we can extract just the pixels of the objects that are moving. The following figures illustrate this process:-
In the above figures two sample images were first converted to grayscale and then absolute difference was applied to subtract sample image 2 from sample image 1.
2. cv2.GaussianBlur:This function allows the image to be convulated with a Gaussian filter instead of a box filter. The Gaussian filter is a low pass filter which removes the high frequency components. This reduces the amount of noise in the image.An example would be:-
3. cv2.cvtcolor:This method allows the conversion of an image from one image space to another and in this case this is used for converting the image from color to monochrome color space.
The above two figures illustrate the conversion of a color image to grayscale by using cvtcolor method.
4. cv2.dilate:This method is used for increasing the area of the bright region in contrast to the dark region in a monochrome image.
Figures 1.7 and 1.8 illustrate the increase in bright regions when dilation is applied.
5. cv2. find Contours:A contour is defined as a curve joining all the points along the boundary of an image having roughly the same intensity. This function helps in extracting the contours of a given image.
6. cv2. Threshold:Thresholding is a technique in image processing which is the assignment of pixel values in relation to the threshold value provided. If the pixel value is less than the threshold value, then that pixel is assigned he value of 0 else that pixel is assigned the maximum possible value (generally 255). The algorithm assumes f (x, y) is a co-ordinate pixel value and T is the assigned threshold value. Now if the value of pixel f (x, y) is less than T, then it’s value is set as 0 whereas if the value of pixel f (x, y) is more than T then its value is set as 255 (maximum value). Hence the foreground and background have a sharp contrast between them which allows accurate contour detection.
II. LITERATURE REVIEW
Authors M.H.Assaf et al.(2012) [1] in their paper describe a field programmable logic array based system which covers the entire apartment of the user and detects the exact room where intrusion has been detected. The system then goes on to alerting the user using email and web based interfaces. This system has multiple redundancies implemented which it is used in case of exceptional occurrences like power failure or even partial system failure. There is also a future scope of configuring this system to monitor the house in real time and also making it interface with other appliances.
Authors Kalathiripi et al.(2019) [2] described a comprehensive security system which made use of 2 cameras for facial recognition and also a sonar based object detection module which allowed the system to accurately detect the presence of people. This The system also used a facial recognition for classifying the person detected as an intruder or not by comparing the facial data with that stored on a server.
Authors Azlan Abu et al.(2018) [3] have worked upon a particular aspect of a home security system I, e. They have worked upon motion detection by using a passive IR sensor coupled with an Arduino module. This arrangement in particular can be implemented to monitor door status in a house. They have also made use of the favourite platform which is used for collecting sensor data from various sensors in an IOT project and then view and work with the data through the internet.
III. MOTIVATION
Commonly available and orthodox security systems are often out of reach for the general public due certain characteristics associated with them. The system under analysis in this paper aspires to make the security system available and affordable for the masses while also creating an open source opportunity for individual development.
The reasons why current security systems are not feasible for the general public are as follows:-
The systems are targeted towards business organizations and the exorbitantly expensive pricing of them confirms this.
The systems require specialized knowledge for setting up and maintenance.
The systems are often rigid in terms of their specifications and cannot be moulded to individual requirements.
IV. METHODOLOGY
A. Basic Methodology
Steps involved
Video capturing is initiated and every two consecutive frames are compared for detecting relative motion.
For motion detection frames are pre-processed and by converting them to grayscale images and then applying Gaussian Blur for reducing noise.
Once absolute difference between two frames are calculated, contours around edges of object in motion are detected and drawn.
Depending upon the area covered within those contours, decision is made for triggering the alarm system or not.
B. Methodology For Motion Detection
Detecting motion by comparing consecutive frames involves the following steps:-
Two consecutive frames are taken from the video feed.
Frames are converted to grayscale as difference between frames can only be found in images having binary colour space.
Gaussian filtering is applied to remove ‘salt and pepper noise’ from captured frames.
Absolute difference operation is performed by having frame 1 and frame 2 as parameters. This operation subtracts the image background and only eaves those pixels in the pixel array whose positions differ between the two frames.
Dilation is performed to increase size of bright regions in the results obtained in step 4.
Threshold operations are performed to clearly distinguish between mobile object and stationary background. The object now appears bright white.
Contours along the edges of object are detected and drawn.
V. PROPOSED WORK
In order to achieve the motion recognition and alerting capabilities expected of this system, the following is proposed:-
Flowchart indicated in Fig 2 ha the following stages:-
When we start the program, the video recording begins.
Then objects in the frame are identified by removing the background.
The background is filtered again, enhancing the features of the object.
Two consecutive frames from the video are checked for difference in them.
If difference is less than that of set threshold then the loop is continued.
If the difference is more than set threshold then the alerting system is activated.
A snapshot of the moment when the intruder stepped in front of camera is captured.
This snapshot accompanied with a warning message is sent through email and mobile notification.
This process continues till the user presses the designated key to stop the system
Libraries Used
The following libraries are used for implementing the entirety of proposed system:-
Conclusion
The rise of mega metro settlements, an ever widening pay gap and a devastating global pandemic has lead to countless people losing their livelihoods and other known sources of income, under such unfortunate circumstances, desperate people have lead to sky high crime rates where most of the crimes involve robberies. Under such circumstances a wide bracket of people for the first time have considered opting for security and surveillance systems. However till date the the security industry was not quite targeted towards individual homes and the solutions they offered came at a considerable and are almost not affordable. Hence in this project we have tried to create an effective software which could detect intruders and also send digital alerts to the user. Versatility has always been a key aspect while creating this project. Hence as a result the final software can be implemented through a variety of different hardware setups, no matter how crude they may seem. This has been an attempt to fulfill the required specifications for such a system and the results look promising. Further work and improvement on this topic will further improve and provide lucrative solutions for this segment which would be able to identify people’s faces and then selectively perform the task of face recognition based on whether the person is denoted as a intruder or not in system database.
References
[1] Summerfield Mark,Programming in Python 3,Developer’s library:2018,Pearson education
[2] Sandipan Dey,Image processing Masterclass in Python,BPB publications
[3] M. H. Assaf, R. Mootoo, S. R. Das, E. M. Petriu, V. Groza and S. Biswas, \"Sensor based home automation and security system,\" 2012 IEEE International Instrumentation and Measurement Technology Conference Proceedings, 2012, pp. 722-727, doi: 10.1109/I2MTC.2012.6229153.
[4] Kalathiripi Rambabu, V.Haritha(2019)IoT Based Human Intrusion Detection System using Lab View in IJCER
[5] Abu, Mohd Azlan & Nordin, Siti Fatimah & Suboh, Mohd Zubir & Yid, Mohd & Ramli, Aizat. (2018). Design and Development of Home Security Systems based on Internet of Things Via Favoriot Platform. International Journal of Applied Engineering Research.
[6] https://www.youtube.com/watch?v=UOIKXp82iEw&t=1010s
[7] https://pypi.org/project/pushbullet-tools/
[8] https://stackoverflow.com/questions/920910/sending-multipart-html-emails-whic h-contai n-embedded-images
[9] https://www.geeksforgeeks.org/python-opencv-cv2-imread-method/
[10] https://docs.python.org/3/library/winsound.html
[11] https://www.authentise.com/post/how-to-track-objects-with-stationary-backgrou nd
[12] https://www.geeksforgeeks.org/python-thresholding-techniques-using-opencv-se t-1-simple-thresholding/
[13] https://medium.com/@florestony5454/median-filtering-with-python-and-opencv -2bce390be0d1
[14] https://docs.opencv.org/3.4/db/df6/tutorial_erosion_dilatation.html