SECURITY CAMERA SYSTEM with HUMAN DETECTION

Introduction

Our project idea is to utilize a Raspberry Pi 3 to build a webcam server that provides a platform for users to remotely monitor their homes over the internet. DropBox uploading of captured images and email notifications will be triggered if a human is detected to warn the user of potential intruders. One usage of this project is to provide a home security system for homeowners while they are physically absent.

The hardware of the system includes a Raspberry Pi 3, a Pi Cam, and a pan-tilt kit with two servos that provides 180 degrees of up/down and left/right rotation. Our final software is based on experimenting with existing OpenCV libraries by using various combinations of motion, face, and human body detection to find the optimal combination of performance versus accuracy for a practical security system.

Objective

The objective of this project is to build a human detection security camera system that monitors a home and captures images of potential intruders. The camera mechanism rotates either automatically or manually to track a face when a human is within view of the camera. A notification is sent to the homeowner immediately upon detection of a human to warn the user of the security status of their home.


System Design

Figure 1. System Design

The Pi Server provides video streaming and runs human face detection and body detection to distingush humans from non-human objects. Notifications are sent to users through email and uploaded to users’ DropBox accounts upon detection.

Hardware Implementation

System Schemetic and Flow Chart Design

Figure 2. System Block Diagram
Figure 3. System Design Flowchart

The above figures show the design of our system. The servos of the pan-and-tilt kit are connected to 2 GPIO output pins of the Raspberry Pi to enable their control via PWMs. They were powered by an external 4.5V supply, either from a lab bench power supply or a battery pack with a voltage regulator. The Pi Cam was directly connected via the camera slot on the Raspberry Pi’s PCB.

Raspberry Pi3

Figure 4. Raspberry Pi 3 with 1.2GHz 64-bit quad-core ARMv8 CPU, 1 GB RAM

PiCamera Module

Figure 5. Raspberry Pi Camera Module V2 – 8 Megapixel,1080p, 3280 (H) x 2464 (V) Active Pixel Count

Pan Tilt Servos

Figure 6. Pan Tilt Kit with two servos for 180 degrees of up/down and left/right rotation
Figure 7. Final Security Camera System

Software Implementation

Human Detection Algorithm with Opencv

For human body detection, we used existing OpenCV libraries with different combinations of motion, face, and body detection.

Click here for instructions on installing OpenCV3.

Motion Detection

Our motion detector uses OpenCV’s APIs to compute the weighted mean of previous frames along with the current frame to detect changes in the background. By subtracting the computed average of the previous frames from the current frame, we can obtain the difference in frames and compare the frame delta with the specified threshold value. If the delta exceeds the threshold, the motion detector is triggered. The lower the threshold value, the more sensitive the motion detector becomes. The video stream on the screen will have a bounding box drawn around the object and text reading “Occupied” when motion is detected.

Figure 8. Motion detected in dark environment

Human Face Detection

For face detection, we used the Haar cascade classifier as it is capable of significant accuracy detecting human faces. The computational load is also low enough to achieve a reasonable framerate when multithreading on the 4 processing cores of the Raspberry Pi. The Haar cascade face detector already has a classifier trained on human faces, so there is no need for us to perform training.

Figure 9. Face detection with Haar cascade classifier

Click here to download OpenCV Haar cascade classifiers.

Human Body Detection

We worked with two algorithms for human body detection. One is a Haar cascade classifier trained to detect the upper and lower body seperately. The computational load is lower with the Haar cascade at significant expense to accuracy. Thus, we went with the other option and integrated a pedestrian detector that uses a histogram of oriented gradients (HOG) classifier. This algorithm works by detecting different body parts and pieces them together to form a human body. The computation is rather expensive but significantly more accurate than the cascade classifier. (The HOG detector was included in OpenCV with no additional files required for download.)

Figure 10. Human body detection with HOG detector

Dropbox Image Upload of Detected Humans

To trigger the DropBox uploading, users need to have a reigstered DropBox account and save their “dropbox_key” and “dropbox_secret” in the conf.json file (attached in the Appendix section) and consent to DropBox access before running. Once a human is detected, the images will be uploaded automatically into users’ DropBox folders and sent via email if the feature is enabled.

Figure 11. Images stored in the local folder that is linked with the DropBox account

Email Notication of Detected Humans

If a human is detected, an email notification is immediately sent to notify the user of potential intruders. The email notification also includes a captured image of the detected human. The email notification configuration file is attached in the Appendix section.

Install mailutils for email notification$ sudo apt-get install mailutils

Source: SECURITY CAMERA SYSTEM with HUMAN DETECTION

Current Project / Post can also be found using:

  • person detection camera
  • raspberry camera person detection
Scroll to Top