Facial Recognition Door Security System Using Raspberry Pi

You might also like

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

FACIAL RECOGNITION DOOR SECURITY SYSTEM USING

RASPBERRY PI

i
INDEX
CERTIFICATION i
ACKNOWLEDGEMENTS ii
ABSTRACT iii
LIST OF FIGURES vi
LIST OF TABLES vii

CHAPTER 1
OVERVIEW OF SYSTEM
1.1 Introduction 1
1.2 Aim of the project 1
1.3 Methodology 2
1.4 Significance of work 2
1.5 Organization of the system 3
CHAPTER 2
HARDWARE DESCRIPTION
2.1 Raspberry pi 3 Model B 4
2.1.1 Technical specifications 4
2.1.2 Connectors 5

ii
2.1.3 GPIO 7
2.1.4 USB chip 7
2.1.5 Antenna 8
2.2 Relay 9
2.3Webcam 11
2.4 Push-Pull solenoid 13
2.5 Power supply 14
2.5.1 What is power supply 14
2.5.2 Why a power supply? 14
2.6 Applications of Raspberry Pi 17
CHAPTER 3
SOFTWARE
3.1 OPENCV 18
3.1.1Pixel types 18
3.1.2 Image Normalization 19
3.1.3 Edge detection 19
3.1.4 Image smoothing 20
3.1.5 Install Opencv python on NOOBS 20
3.1.6 Opencv classifier 21
3.1.7 Preparation of the training data 22
3.18 Applications 23
3.2 Raspbian OS 23
3.2.1 Present Raspbian with NOOBS 25
3.2.2 Download image Raspbian directly 26
CHAPTER 4
WORKING OF THE SYSTEM
4.1 Working of system 31
4.2 Block diagram description 32

CHAPTER 5

iii
RESULTS AND CONCLUSION
5.1 Result 33
5.2 Conclusion 33

REFERENCES 35

LIST OF FIGURES

Figure 1-1 Block diagram and Flow chart 2


Figure 2-1 Raspberry Pi 3 Model B 6
Figure 2-2 System On chip 6
Figure 2-3 GPIO pins 7
Figure 2-4 USB chip 7
Figure 2-5 Antenna 8
Figure 2-6 Schematic description 8
Figure 2-7 Circuit symbol of Relay 9
Figure 2-8 Relay operation and use of protection diode 10
Figure 2-9 Webcam 11
Figure 2-10 Push-Pull solenoid 13
Figure 2-11 DC 12v/5A power supply 15
Figure 2-12 Functional block diagram of power supply 15
Figure 3-1 Pixel types 19
Figure 3-2 Image Normalization 19
Figure 3-3 Edge detection 20
Figure 3-4 Image smoothing 20
Figure 3-5 Eigen faces 22
Figure 3-6 Raspberry Pi software system 24

iv
Figure 3-7 SD card formatter window 25
Figure 3-8 Raspberry Pi website home 25
Figure 3-9 Raspbian OS download page 26
Figure 3-10 Raspbian image download page 27
Figure 3-11 Downloaded image file 27
Figure 3-12 List of OS window 28
Figure 3-13 Raspberry pi home window 28
Figure 4.1 Flow chart of system 32
Figure 4.2 Block diagram 33

LIST OF TABLES
2.1 Power supply Specifications 16

v
CHAPTER 1
OVERVIEW OF SYSTEM

1.1 Introduction

The facial recognition technology is used to automatically identify a person through a digital
image. It is mainly used in security systems. The facial recognition will directly capture
information about the shapes of faces. The main advantage of facial recognition is, it identifies
each individual’s skin tone of a human face’s surface, like the curves of the eye hole, nose, and
chin, etc. this technology may also be used in very dark condition. It can view the face in
different angles to identify.

It is mainly used in airports were it will recognize the face and we can avoid some
unwanted terrorist. When compared with other biometrics systems using fingerprint and iris, face
recognition has different advantages because it is without touching the person. Through Face
images we can capture the person identification from a distance without touching or interacting
with them. And also face recognition is used for crime restriction purpose because face images
that have been recorded and archived, so that it will help us to identify a person later.

This report develops a socio-political analysis that bridges the technical and social-scientific
literature on FRT and addresses the unique challenges and concerns that attend its development,
evaluation, and specific operational uses, contexts, and goals. It highlights the potential and
limitations of the technology, noting those tasks for which it seems ready for deployment, those
areas where performance obstacles may be overcome by future technological developments or
sound operating procedures, and still other issues which appear intractable. Its concern with
efficacy extends to ethical considerations.

In today’s world of connectivity and smart devices there is an urgent need to modify our
existing day to day objects and make them smart, also it is not the era when we can blindly trust
the old and conventional security measures, specifically speaking is our bank lockers. To change

1
and modernize any object we need to eliminate its existing drawbacks and add extra
functionality.
The major drawbacks in a conventional door lock by duplicating or stealing the key. An
era has come where devices can interact with its users and at the same time ensure of their
safety and keep improvising themselves.
The major concepts used to design and model this access control system is advanced knowledge
of micro controllers and interfaces, as the Raspberry Pi computing device is used and interfaced
with different drivers along with application development to develop a desktop application. Live
high quality HD Camera is connected with the display using the same processor to provide the
functionalities mentioned above. The photo is captured and processed through the app which
detects face out of the available Eigen faces. In addition to this different an intensive study of
open cv platform and its inbuilt libraries has been conducted to generate a code, which does
correct and reliable facial recognition with new and efficient use of hardware. As the world is
progressing people are scared about the safety of their possessions, information and themselves.
With the model of Smart Locker, a profound impact is expected on the security industry and it is
somewhat anticipated as the time has come to make all daily life objects interconnected and
interactive. This model will be a major contribution to the field of Bank Security.

1.2 Aim of the project

The aim of this project is to just eliminate these problems. So, to simply convert this
normal door lock into a smart lock, which can open the door whenever we turn up in front of the
gate or when we want it to, open up for someone else without being physically present, we need
to modify the door. So an era has come where devices can interact with its users and at the same
time ensure of their safety and keep improvising themselves.

1.3 Methodology

The major concepts used to design and model this access control system is advanced knowledge
of micro controllers and interfaces, as the Raspberry Pi computing device is used and interfaced
with different drivers along with application development to develop a desktop application. Live
high quality HD Camera is connected with the display using the same processor to provide the

2
functionalities mentioned An intensive study of Open CV platform and its inbuilt libraries has
been conducted to generate a code, which does correct and reliable facial recognition with new
and efficient use of hardware. As the world is progressing people are scared about the safety of
their possessions, information and themselves.

1.4 Significance of work


With the model of Smart Door a profound impact is expected on the security industry and
it is somewhat anticipated as the time has come to make all daily life objects interconnected and
interactive. This model will be a major contribution to the field of Home Security. Privacy and
Security are two universal rights and, to ensure that in our daily life we are secure, a lot of
research is going on in the field of home security, and IoT is the turning point for the industry,
where we connect everyday objects to share data for our betterment.

Applications
 Payments
 Bank lockers
 Access and security
 Image database investigations
 Voting system
 Banking Using ATM
 Replacement of PIN, physical tokens

1.5 Organization of work


The report comprises of 4 chapters as shown below
CHAPTER 1: Deals with Introduction of the project and presenting the Aim and methodology
of project.
CHAPTER 2: Deals with Hardware components and their explanation.
CHAPTER 3: Deals with software related to the project.
CHAPTER 4: Deals with Block diagram and flow chart of the system.
CHAPTER 5: Deals with results and conclusion

3
CHAPTER 2
HARDWARE DESCRIPTION

2.1 Raspberry Pi 3 Model B


Raspberry Pi is a credit card sized bargain micro Linux machine. The goal behind
creating Raspberry Pi was to create a low cost device that would improve programming skills
and hardware understanding for students. The latest model of Raspberry Pi comes sporting 1 GB
of RAM, 1200 MHz quad – core ARM Cortex-A53 processor, and basic levels of functionality
that enables hobbyists, computer enthusiasts, and students to use this device for DIY projects.

4
Raspberry Pi is open hardware with the exception of its primary chip, the Broadcom SOC which
runs the main components of the board – CPU, graphics, memory, USB controller etc.

2.1.1 Technical Specification:


Processor
 Broadcom BCM2387 chipset.
 1.2GHz Quad-Core ARM Cortex-A53 (64Bit)

802.11 b/g/n Wireless LAN and Bluetooth 4.1 (Bluetooth Classic and LE)

 IEEE 802.11 b / g / n Wi-Fi. Protocol: WEP, WPA WPA2, algorithms AES-


CCMP (maximum key length of 256 bits), the maximum range of 100 meters.
 IEEE 802.15 Bluetooth, symmetric encryption algorithm Advanced Encryption
Standard (AES) with 128-bit key, the maximum range of 50 meters.

GPU
 Dual Core Video Core IV® Multimedia Co-Processor. Provides Open GL ES
2.0, hardware-accelerated Open VG, and 1080p30 H.264 high-profile decode.
 Capable of 1Gpixel/s, 1.5Gtexel/s or 24GFLOPs with texture filtering and DMA
infrastructure

Memory
• 1GB LPDDR2

Operating System
 Boots from Micro SD card, running a version of the Linux operating system or
Windows 10 IoT.

Dimensions
 85 x 56 x 17mm

Power
 Micro USB socket 5V1, 2.5A

5
2.1.2 Connectors
Ethernet
 10/100 BaseT Ethernet socket

Video Output
 HDMI (rev 1.3 & 1.4)
 Composite RCA (PAL and NTSC)

Audio Output
 Audio Output 3.5mm jack
 HDMI
 USB 4 x USB 2.0 Connector

GPIO Connector
 40-pin 2.54 mm (100 mil) expansion header: 2x20 strip
 Providing 27 GPIO pins as well as +3.3 V, +5 V and GND supply lines

Camera Connector
 15-pin MIPI Camera Serial Interface (CSI-2)

Display Connector
 Display Serial Interface (DSI) 15 way flat flex cable connector with two data
lanes and a clock lane
Memory Card Slot
 Push/pull Micro SDIO

The GPU provides Open GL ES 2.0, hardware-accelerated Open VG, and 1080p30
H.264 high-profile decodes and is capable of 1Gpixel/s, 1.5Gtexel/s or 24 GFLOPs of
general purpose compute. What’s that all mean? It means that if you plug the Raspberry Pi
3 into your HDTV, you could watch BluRay quality video, using H.264 at 40MBits/s.
The biggest change that has been enacted with the Raspberry Pi 3 is an upgrade to a next
generation main processor and improved connectivity with Bluetooth Low Energy (BLE)
and BCM43143n Wi-Fi on board. Additionally, the Raspberry Pi 3 has improved power

6
management, with an upgraded switched power source up to 2.5 Amps, to support more
powerful external USB devices.

Fig. 2.1 Raspberry Pi 3 Model B

Built specifically for the new Pi 3, the Broadcom BCM2837 System-on-Chip (SoC)
includes four high-performance ARM Cortex-A53 processing cores running at 1.2GHz with
32kB Level 1 and 512kB Level 2 cache memory, a Video Core IV graphics processor, and is
linked to a 1GB LPDDR2 memory module on the rear of the board.

Fig. 2.2 System on Chip


2.1.3 GPIO
The Raspberry Pi 3 features the same 40-pin general-purpose input-output (GPIO)
header as all the Pins going back to the Model B+ and Model A+. Any existing GPIO
hardware will work without modification; the only change is a switch to which UART is
exposed on the GPIO’s pins, but that’s handled internally by the operating system.

7
Fig. 2.3 GPIO pins
2.1.4 USB chip
The Raspberry Pi 3 shares the same SMSC LAN9514 chip as its predecessor, the
Raspberry Pi 2, adding 10/100 Ethernet connectivity and four USB channels to the board.
As before, the SMSC chip connects to the SoC via a single USB channel, acting as a USB-
to-Ethernet adaptor and USB hub.

Figure 2.4 USB chip


2.1.5 Antenna
There’s no need to connect an external antenna to the Raspberry Pi 3. Its radios are
connected to this chip antenna soldered directly to the board, in order to keep the size of
the device to a minimum. Despite its diminutive stature, this antenna should be more than
capable of picking up wireless LAN and Bluetooth signals – even through walls.

8
Fig. 2.5 Antenna

Fig. 2.6 Schematic Description


2.2 RELAY
A relay is an electrically controllable switch widely used in industrial controls,
automobiles and appliances.
The relay allows the isolation of two separate sections of a system with two different
voltage sources i.e., a small amount of voltage/current on one side can handle a large amount of
voltage/current on the other side but there is no chance that these two voltages mix up inductor.

9
Figure 2-7 Circuit symbol of a relay

Operation:
When a current flow through the coil a magnetic field is created around the coil i.e., the
coil is energized. This causes the armature to be attracted to the coil. The armature‘s contact acts
like a switch and closes or opens the circuit. When the coil is not energized, a spring pulls the
armature to its normal state of open or closed. There are all types of relays for all kinds of
applications.

Figure 2-8: Relay Operation and use of protection diode

Transistors and ICs must be protected from the brief high voltage 'spike' produced when
the relay coil is switched off. The above diagram shows how a signal diode (e.g. 1N4148) is
connected across the relay coil to provide this protection. The diode is connected 'backwards' so
that it will normally not conduct. Conduction occurs only when the relay coil is switched off, at
this moment the current tries to flow continuously through the coil and it is safely diverted
through the diode. Without the diode no current could flow and the coil would produce a
damaging high voltage 'spike' in its attempt to keep the current flowing.

In choosing a relay, the following characteristics need to be cons


1. The contacts can be normally open (NO) or normally closed (NC). In the NC type, the
contacts are closed when the coil is not energized. In the NO type, the contacts are closed when
the coil is energized.
2. There can be one or more contacts. i.e., different types like SPST (single pole single throw),

10
SPDT (single pole double throw) and DPDT (double pole double throw) relay.
3. The voltage and current required to energize the coil. The voltage can vary from a few volts to
50 Volts, while the current can be from a few milliamps to 20milliamps. The relay has a
minimum voltage, below which the coil will not be energized. This minimum voltage is called
the ―pull-in‖ voltage.
4. The minimum DC/AC voltage and current that can be handled by the contacts. This is in the
range of a few volts to hundreds of volts, while the current can be from a few amps to 40A or
more, depending on the relay.

DRIVING A RELAY:
An SPDT relay consists of five pins, two for the magnetic coil, one as the common
terminal and the last pins as normally connected pin and normally closed pin. When the current
flows through this coil, the coil gets energized. Initially when the coil is not energized, there will
be a connection between the common terminal and normally closed pin. But when the coil is
energized, this connection breaks and a new connection between the common terminal and
Normally open pin will be established. Thus when there is an input from the microcontroller to
the relay, the relay will be switched on. Thus when the relay is on, it can drive the loads
connected between the common terminals and normally open pin. Therefore, the relay takes 5V
from the microcontroller and drives the loads which consume high currents. Thus the relay acts
as an isolation device.
Digital systems and microcontroller pins lack sufficient current to drive the relay. While
the relay‘s coil needs around 10milli amps to be energized, the microcontroller‘s pin can provide
a maximum of 1-2milli amps current. For this reason, a driver such as ULN2003 or a power
transistor is placed in between the microcontroller and the relay. In order to operate more than
one relay, ULN2003 can be connected between relay and microcontroller

2.3 WEBCAM
"Webcam" refers to the technology generally; the first part of the term ("web-") is often
replaced with a word describing what can be viewed with the camera, such as a net cam or street
cam.
Webcams are video capturing devices connected to computers or computer networks,
often using USB or, if they connect to networks, Ethernet or Wi-Fi. They are well-known for low

11
manufacturing costs and flexible applications.

Video capture is the process of converting an analog video signal—such as that


produced by a video camera or DVD player—to digital form. The resulting digital data are
referred to as a digital video stream, or more often, simply video stream. This is in contrast with
screen casting, in which previously digitized video is captured while displayed on a digital
monitor.

Webcams typically include a lens, an image sensor, and some support electronics.
Various lenses are available, the most common being a plastic lens that can be screwed in and
out to set the camera's focus. Fixed focus lenses, which have no provision for adjustment, are
also available. Image sensors can be CMOS or CCD, the former being dominant for low-cost
cameras, but CCD cameras do not necessarily outperform CMOS-based cameras in the low cost
price range. Consumer webcams are usually VGA resolution with a frame rate of 30 frames per
second. Higher resolutions, in mega pixels, are available and higher frame rates are starting to
appear.

Figure 2.9 Webcam


The video capture process involves several processing steps. First the analog video signal
is digitized by an analog-to-digital converter to produce a raw, digital data stream. In the case of
composite video, the luminance and chrominance are then separated. Next, the chrominance is
demodulated to produce color difference video data. At this point, the data may be modified so
as to adjust brightness, contrast, saturation and hue. Finally, the data is transformed by a color
space converter to generate data in conformance with any of several color space standards, such
as RGB and YCbCr. Together, these steps constituted video decoding, because they "decode" an
analog video format such as NTSC or PAL.
Support electronics are present to read the image from the sensor and transmit it to the
host computer. The camera pictured to the right, for example, uses a Sonix SN9C101 to transmit

12
its image over USB. Some cameras - such as mobile phone cameras - use a CMOS sensor with
supporting electronics.

FEATURES:
Smallest wireless video & audio camera
Wireless transmission and reception
High sensitivity
Easy installation & operation
Easy to conceit
Light weight
Low power consumption
Small size

SPECIFICATIONS:
Output frequency: 900MHZ 1200MHZ
Output power: 50mW 200mW
Power supply: DC +6~12v
Distance covered: 10m

2.4 PUSH-PULL SOLENOID


Solenoids are basically electromagnets: they are made of a big coil of copper wire with
an armature (a slug of metal) in the middle. When the coil is energized, the slug is pulled into the
center of the coil. This makes the solenoid able to pull or push
This solenoid in particular is fairly small, with a 30mm long body and a 'captive'
armature with a return spring. This means that when activated with up to 12VDC, the solenoid
moves and then the voltage is removed it springs back to the original position, which is quite
handy. Many lower cost solenoids are only push type or only pull type and may not have a
captive armature (it'll fall out!) or don't have a return spring. This one even has nice mounting
tabs, its a great all-purpose solenoid.

13
To drive a solenoid you will need a power transistor and a diode, check this diagram for
how to wire it to an Arduino or other microcontroller. You will need a fairly good power supply
to drive a solenoid, as a lot of current will rush into the solenoid to charge up the electro-magnet,
about 250mA, so don't try to power it with a 9V battery. 2 VDC operation (please note lower
voltage results in weaker/slower operation) - 250mA current draw

Details:
Push or pull type with 5.5 mm throw
DC coil resistance: 40 ohms
5 Newton starting force (12VDC)
1.4 oz / 39 grams

Figure 2.10 Push-Pull solenoid


FEATURES
• For Linear Push Pull Operations.
• Fast Actuation.
• With bracket for easy mounting.
• Available in continuous half & quarter duty cycle.
• Three force level for one size.
• Suitable for high frequency operation.
• No risk of coil burnout.
• Long life.
• Replaces costly Pneumatic & hydraulic, equipments used for linear operations.
• Compact & cost effective solution. Solenoids

As the magnetic field is created instantly, solenoids make a great fit for applications that

14
require immediate action. Their simplicity makes them inexpensive, and they can pack a lot of
power into a very small form factor. However, since their force is proportional to the position of
their moving elements, they work best for short distances, making them ideal for valves,
interlocks, electromechanical relays, etc.

2.5 Power Supply


2.5.1. What is a power supply?
A power supply is a device that supplies power to another device, at a specific voltage
level, voltage type and current level. For example, when we talk about a 9VDC @ 500mA power
supply can provide as much as 500mA of current and the voltage will be at least 9V DC up to
that maximum current level. While it sounds simple, power supplies have a lot of little hang-ups
that can be very tricky for the uninitiated. For example, unregulated supplies say they can
provide 9V but really may be outputting 15V! The very common 7805 regulator datasheet claims
it can regulate up to 1000 mA of current, but when you put a 15V supply on one side, it
overheats and shuts down! This tutorial will try to help explain all about power supplies.

2.5.2. Why a power supply?


When you start out with electronics, you'll hear a lot about power supplies - they're in
every electronics project and they are the backbone of everything! A good power supply will
make your project hum along nicely. A bad power supply will make life frustrating: stuff will
work sometimes but not others, inconsistent results, motors not working, sensor data always off.
Understanding power supplies (boring though they may be) is the key to making your project
work!
A lot of people don't pay much attention to power supplies until problems show up. We
think you should always think about your power supply from day one - How are you going to
power it? How long will the batteries last? Will it overheat? Can it get damaged by accidentally
plugging in the wrong thing? Power supplies are all around you! Unless you live in a shack in
the woods, you probably have a dozen power supplies in your home or office.

15
Fig. 2.11 DC 12V/5A Power Supply
The power supply is designed to convert high voltage AC mains electricity to a suitable low
voltage supply for electronic circuits and other devices. A power supply can by broken down into
a series of blocks, each of which performs a particular function. A D.C. power supply which
maintains the output voltage constant irrespective of AC mains fluctuations or load variations is
known as “Regulated D.C Power Supply” For example a 5V regulated power supply system as
shown below:

Fig 2.12: Functional Block Diagram of Power supply

Power Power Commonly


Technique Pros Cons
type in type out seen…
High Small
Low
motors, in
Really
Voltage Really cheaper
voltage cheap,
Transformer big & power
AC (e.g. electrically supplies
AC (e.g. Heavy!
120V- isolated before the

16
12VAC) regulator
220VAC)

Low High Same as Some kinds


above, but Really of
Voltage voltage
the big & inverters,
Transformer
transformer EL wire or
AC (e.g. AC (e.g. Heavy!
is flash bulb
flipped drivers
20VAC) ~120VAC)
around

High
High Very
Voltage
We've seen
voltage Half or full inexpensive
Not these in
AC (e.g.
wave (just a isolated
DC (e.g. tube amps
rectifier diode
120V-
170VDC) or two)
220VAC)

Practically
Low Low Very all

consumer
Voltage voltage Half or full inexpensive
Not electronics
wave (just a isolated that have
AC (e.g. DC (e.g.
rectifier diode transformer-
based
20VAC) 5VDC) or two)
supplies

17
Transformer
High & Heavy,

Low rectifier
output is
Voltage
not Every
voltage Combination Fairly chunky
AC (e.g. precise, wall-
wart
DC (e.g. of High-low inexpensive contains
efficiency
120V- this
is
5VDC) AC & Low
220VAC) so-so
AC→Low
DC

Table 2.11 Power Supply Specifications


2.6 Applications of Raspberry Pi:
 Due to its headway in its innovation it is broadly favored continuously task contrasted
with others.
 Raspberry Pi controllers are utilized as a part of uses like Media streamer, Tablet PCs.

18
CHAPTER 3
SOFTWARE

3.1 OPENCV
OpenCV was started at Intel in 1999 by Gary Bradsky and the first release came out in
2000. Vadim Pisarevsky joined Gary Bradsky to manage Intel‘s Russian software OpenCV team.
In 2005, OpenCV was used on Stanley, the vehicle who won 2005 DARPA Grand Challenge.
Later its active development continued under the support of Willow Garage, with Gary Bradsky
and Vadim Pisarevsky leading the project. Right now, OpenCV supports a lot of algorithms
related to Computer Vision and Machine Learning and it is expanding day-by-day. Currently
OpenCV supports a wide variety of programming languages like C++, Python, and Java etc and
is available on different platforms including Windows, Linux, OS X, Android, iOS etc. Also,
interfaces based on CUDA and OpenCL are also under active development for high-speed GPU
operations. OpenCV-Python is the Python API of OpenCV. It combines the best qualities of
OpenCV C++ API and Python language.
OpenCV is an Image Processing library created by Intel and maintained by Willow Garage.
• Available for C, C++, and Python
• Newest update is version 2.2
• Open Source and free
• Easy to use and install

Programming Language
OpenCV is written in C++ and its primary interface is in C++, but it still retains a less
comprehensive though extensive older C interface. There are bindings in Python, Java and
MATLAB/OCTAVE. The API for these interfaces can be found in the online documentation.
Wrappers in other languages such as C#, Perl, Ch, and Ruby have been developed to
encourage adoption by a wider audience. All of the new developments and algorithms in
OpenCV are now developed in the C++ interface.

3.1.1 Pixel Types


 Pixel Types shows how the image is represented in data

19
 BGR - The default color of imread (). Normal 3 channel color
 HSV - Hue is color, Saturation is amount, and value is lightness. 3 channels
 GRAYSCALE - Gray values, Single channel
 OpenCV requires that images be in BGR or Grayscale in order to be shown or saved.
Otherwise, undesirable effects may appear.

Figure 3-1 Pixel types


3.1.2 Image Normalization
 Normalize (image in, image out, low, high, method);
 Image normalization is the process of stretching the range of an image from [a, b] to [c,
d].
 This is incredibly important for visualization because if the image is beyond [0,255] it
will cause truncation or unsightly effects.

Figure 3-2 Image Normalization


3.1.3 Edge Detection
 Sobel Edge Detection void cv::Sobel(image in, image out, CV_DEPTH, dx, dy);
 Scharr Edge Detection void cv::Scharr(image in, image out, CV_DEPTH, dx, dy);
 Laplacian Edge Detection void cv::Laplacian( image in, image out, CV_DEPTH);

20
Figure 3.3 Edge Detection
3.1.4 Image Smoothing
• Image smoothing is used to reduce the sharpness of edges and detail in an image.
• OpenCV includes most of the commonly used methods.
• void GaussianBlur(image in, imageout, Size ksize, sig);
• void medianBlur (image in, imageout, Size ksize);
• Other functions include generic convolution, separable convolution, dilate, and erode. Original
Gaussian Blur Median blur

Figure 3-4 Image Smoothing


3.1.5 Install OpenCv Python on NOOBS
Now since your SD card is ready, Boot your Pi. First thing you want to do is Enable Camera.
To do this run

Sudo raspi-config and chose Enable Camera (menu 6) also chose the correct speed for your
Raspberry Pi from Overclock option (menu 8).

Reboot your Raspberry Pi. Now it is time to install python wrapper for OpenCV, to do this run
Sudo apt-get install python opencv
Sudo pip install imutils

21
3.1.6 OpenCV Classifier
The work with a cascade classifier includes two major stages: training and detection.
Detection stage is described in a documentation of object detect module of general
OpenCV documentation. Documentation gives some basic information about cascade classifier.
Current guide is describing how to train a cascade classifier: preparation of the training data and
running the training application. There are two applications in OpenCV to train cascade
classifier: OpenCV_haartraining and OpenCV_traincascade. Opencv_traincascade is a newer
version, written in C++ in accordance to OpenCV 2.x API. But the main difference between
this two applications is that OpenCV_traincascade supports both Haar and (Local Binary
Patterns) features.
Steps:
1. Read the image.
2. Load Face cascade (Cascade Classifier > load)
3. Detect faces (detectMultiScale)
4. Draw circles on the detected faces (ellipse)
5. Show the result.
Functions:
Ellipse, detectMultiScale, imshow, imread, named Window, wait Key.
First, a classifier (namely a cascade of boosted classifiers working with haar-like
features) is trained with a few hundred sample views of a particular object (i.e., a face or a car),
called positive examples, that are scaled to the same size (say, 20x20), and negative examples -
arbitrary images of the same size. After a classifier is trained, it can be applied to a region of
interest (of the same size as used during the training) in an input image. The classifier outputs a
―1‖ if the region is likely to show the object (i.e., face/car), and ―0‖ otherwise. To search for
the object in the whole image one can move the search window across the image and check
every location using the classifier.
The classifier is designed so that it can be easily ―resized‖ in order to be able to find the
objects of interest at different sizes, which is more efficient than resizing the image itself. So, to
find an object of an unknown size in the image the scan procedure should be done several times
at different scales.

22
A video is made with for each stage each feature visualized:

Each stage is stored as an image for future validation of the features:

Figure 3.5 Eigen faces

3.1.7 Preparation of the training data


For training a boosted cascade of weak classifiers we need a set of positive samples
(containing actual objects you want to detect) and a set of negative images (containing

23
everything you do not want to detect). The set of negative samples must be prepared manually,
whereas set of positive samples is created using the OpenCV_createsamples application.

Negative Samples
Negative samples are taken from arbitrary images, not containing objects you want to
detect. These negative images, from which the samples are generated, should be listed in a
special negative image file containing one image path per line (can be absolute or relative). Note
that negative samples and sample images are also called background samples or background
images, and are used interchangeably.
Positive Samples
Positive samples are created by the OpenCV create samples application. They are used by
the boosting process to define what the model should actually look for when trying to find your
objects of interest. The application supports two ways of generating a positive sample dataset.
You can generate a bunch of positives from a single positive object image. You can supply all
the positives yourself and only use the tool to cut them out, resize them and put them in the
OpenCV needed binary format.

3.1.8 Applications
OpenCV's application areas include:
2D and 3D feature toolkits
Ego motion estimation
Facial recognition system
Gesture recognition
Human–computer interaction (HCI)
Mobile robotics
Motion understanding
Object identification
Segmentation and recognition
Stereo sis stereo vision: depth perception from 2 cameras
Structure from motion (SFM)

24
3.2 RASPBERRY PI OS:
Getting a raspberry pi working system we have guaranteed we have all the physical equipment
you require. By and by it's a perfect chance to get yourself a working system and boot up your
Raspberry Pi.

Figure 3.6 raspberry Pi software systems

The Raspberry Pi itself doesn't go with a working structure. For that, you require NOOBS, short for
New Out of the Carton Programming. It's a working structure executive that makes it easy to
download, present, and set up your Raspberry Pi. When you first boot up NOOBS, you'll get a
decision of OS is to investigate. Which working systems are open depends whereupon model of
Raspberry Pi you are using. For this guide, we'll hold fast to the most generally perceived OS is
working structures open on the freshest models of the Raspberry Pi. Right now, that is Raspbian,
OSMC, Open ELEC, Windows IoT Center, and RISC OS.
Raspbian is the "specialist" working game plan of the Raspberry Pi and hence, it's the one
a considerable number individual should start with. Raspbian is a version of Linux fabricated
especially for the Raspberry Pi. It comes loaded down with the whole item you'll necessity for
every basic endeavor with a PC. You'll get Libra Office as an office suite, a web program, email
program, and a couple of gadgets to train programming to youngsters and adults alike. For hell's
sake, it even joins a phenomenal (never again being created) type of Mine craft. Raspbian is the
spine for basically every DIY wander out there, so in the event that you want to make something,
Raspbian is presumably where you have to start. Since it's so extensively used, it's also easy to
find controls and researching tips.
The recommended working system for use with the Raspberry Pi is called Raspbian.

25
Raspbian is an adjustment of GNU/Linux, arranged especially to work commendably with the
Raspberry Pi. You have a couple of decisions concerning getting hold of a copy of Raspbian.
3.2.1 Present RASPBIAN WITH NOOBS
NOOBS stays for New out Of Box Programming, and if you've never played around with
GNU/Linux already; by then it's the best place to start. In any case, it's reliably a shrewd idea to
guarantee you have masterminded your SD card. You'll need to guarantee your PC has a worked
in SD card per user, or you can use a USB SD card per user.
1. Visit the SD Alliance's webpage and download SD Formatter 4.0 for either Windows or Mac.
2. Take after the rules to present the item.
3. Embed your SD card into the PC or PC's SD card peruse and impact a note of the drive to
letter distributed to it, e.g. F: /
4. In SD Formatter, select the drive letter for your SD card and association it.

Figure 3.7 SD card formatter window


Download NOOBS
1. Visit the official Raspberry Pi Downloads page.

Figure 3.8 raspberry pi website home


26
2. Click on NOOBS.

Figure 3.9 Raspbian OS download page


3. Click on the Download ZIP catch under 'NOOBS (disconnected and arrange introduce)', and
select an envelope to spare it to.
4. Extract the records from the zip.
5. Once your SD card has been designed, drag every one of the records in the separated NOOBS
organizer and drop them onto the SD card drive.
6. The important records will then be exchanged to your SD card.
7. When this procedure has completed, securely evacuate the SD card and embed it into your
Raspberry Pi.
3.2.2 Download image Raspbian directly
A contrasting option to utilizing NOOBS to introduce Raspbian is to download and introduce
the picture specifically. This is a speedier procedure, and is incredible on the off chance that you
have to picture various cards for a workshop or class.
1. Click on Raspbian.

27
Figure 3.10 Raspbian image download page
1. Click on the Download ZIP button under ‗Raspbian Jessie (full desktop image) ‘, and
select a folder to save it to.
2. Extract the files from the zip.

Figure 3.11 Downloaded image file


3. Visit etcher.io and download and install the Etcher SD card image utility.
4. Run Etcher and select the Raspbian picture you unfastened on your PC or workstation.
5. Select the SD card drive. Note that the product may have officially chosen the correct
drive.
6. Finally, click Consume to exchange Raspbian to the SD card. You'll see an improvement
bar that discloses to you what amount is left to do. Once total, the utility will
consequently launch/unmount the SD card so it's protected to expel it from the PC.

28
The first-time power on:
1. On the off chance that this is the first run through your Raspberry Pi and SD card have been
utilized, at that point you'll need to choose a working framework and arrange it.
2. Once you have connected the power link to your Raspberry Pi, it will boot. On the off chance
that you are utilizing NOOBS, a window will show up with a rundown of various working
frameworks that you can introduce. We suggest that you utilize Raspbian: tick the crate beside
Raspbian and tap on Introduce.

Figure 3.12 List of OS window

Figure 3.13 Raspberry pi home window

Raspbian will then run through its installation process. Please note that this can take a while. At
the point when the introduce procedure has finished, the Raspberry Pi setup menu will stack.

29
Here you can set the time and date for your area, empower a Raspberry Pi camera load up, or
even make clients. You can leave this menu by utilizing Tab on your console to move to wrap
up. If you downloaded Raspbian and imaged it utilizing Etcher instead of NOOBS, at that point
you will boot straightforwardly to the work area condition of Raspbian and won't have to pause

30
CHAPTER 4
WORKING OF THE SYSTEM

4.1 Working of the system

Figure 4.1 Flow chart of system


Facial recognition is a well-established process in which the face is detected and
identified out of the image. In our proof of concept of a smart door we have used a live HD
camera on the front side of setup attached to a display monitor connected with the camera to
show who is standing in front of the door, also the whole system will be able to give voice
outputs by processing text them on the Raspberry Pi ARM processor used and show the answers
as output on the screen. We are using a set of electromagnets controlled by the micro controller,
which will act as a lock. So a person can open the smart door with the help of facial recognition
and at the same time also be able to interact with it. The facial recognition is done by OpenCV.

31
Figure 4.2 Block diagram

4.2 Block diagram description

Power Supply:
This section is meant for supplying Power to all the sections mentioned above. It
basically consists of a Transformer to step down the 230V ac to 9V ac followed by diodes. Here
diodes are used to rectify the ac to dc. After rectification the obtained rippled dc is filtered using
a capacitor Filter. A positive voltage regulator is used to regulate the obtained dc voltage.

Microcontroller:
This section forms the control unit of the whole project. This section basically consists of
a Microcontroller with its associated circuitry like Crystal with capacitors, Reset circuitry, Pull
up resistors (if needed) and so on. The Microcontroller forms the heart of the project because it
controls the devices being interfaced and communicates with the devices according to the
program being written.

Monitor Display:
This section is basically meant to show up the status of the project. This project makes

32
use of monitor to display / prompt for necessary information.

ADVANTAGES
 Security levels will be significantly improved
 The integration process is easy and flawless
 High accuracy allows avoiding false identification
 Facial Recognition System is fully automated
 Time fraud will be excluded
 Inexpensive technique of identification

DISADVANTAGES
 Difficulties with data processing and storing
 Troubles with images size and quality
 Strong influence of the camera angle

33
CHAPTER 5
RESULTS AND CONCLUSION

5.1 Result

The project FACIAL RECOGNITION DOOR SECURITY SYSTEM USING


RASPBERRY PI has been successfully designed and tested. The developed scheme is cheap,
fast, and highly reliable and provides enough flexibility to suit the requirements of different
systems.

5.2 Conclusion
Integrating features of all the hardware components used have developed it. Presence of
every module has been reasoned out and placed carefully thus contributing to the best working of
the unit. With the help of growing technology the project has been successfully implemented.

Future scope
If a blacklisted person tries to open the door, the system will send a message to the admin
using GSM module regarding the same. A real time speaking assistant can be deployed to make
the system more users friendly and efficient. Database can be linked to cloud in case of power
failures and data loss.

34
Highly secure protocols such as TLS can be deployed to ensure there is no security
breach. There is a lot of scope today in the field of home automation and thus we can later enable
GSM and DTMF module in this giving more functionality. Also on larger scale rather than using
ARM processor we can use x-86 processors to enable live feed.

35
REFERENCES
1. Singh, A.; aranam, S.; Kumar, D. "Constructive Learning for Human-Robot Interaction",
IEEE Potentials, Vol 32, Issue 4, 2013, Page(s): 13 – 19.
2. Jayatilake, D.; Isezaki, T.; Teramoto, Y.; Eguchi, K.; Suzuki, K. "Robot Assisted
Physiotherapy to Support Rehabilitation of Facial Paralysis", IEEE Trans Neural Systems
and Rehabilitation Engineering, Vol. 22, Issue 3, 2014, Page(s): 644 - 653.
3. McDuff, D. ; Kaliouby, R.E. ; Picard, R.W. "Crowd sourcing Facial Responses to Online
Videos", IEEE Trans Affective Computing, Vol 3, Issue 4, 2012 , Page(s): 456 – 468
4. Fleck, S.; Strasser, W. "Smart Camera Based Monitoring System and Its Application to
Assisted Living", Proceedings of the IEEE, On page(s): 1698 - 1714 Volume: 96, Issue:
10, Oct. 2008
5. A.Melle, J.-L. Dugelay, ―Scrambling faces for privacy protection using background
self-similarities,‖ Proc. 2014 IEEE International Conference on Image Processing (ICIP),
2014, pp.6046-6050.
6. Z. Erkin, M. Franz, J. Guajardo, S. Katzenbeisser, I. Lagendijk, T. Toft, ―Privacy-
Preserving Face Recognition,‖ Proc. Ninth Int‘l Symp. Privacy Enhancing Technologies
(PETS ‘09), 2009, pp.235-253.
7. F. Dufaux, T. Ebrahimi, ―Scrambling for Video Surveillance with Privacy,‖ Proc. 2006
Conference on Computer Vision and Pattern Recognition Workshop, Washington, DC,
USA, 2006, pp.106-110.
8. F. Dufaux, ―Video scrambling for privacy protection in video surveillance: recent
results and validation framework, Proceedings of SPIE, Vol. 8063, 2011, pp.14.
9. T. Winkler, B. Rinner, ―Security and Privacy Protection in Visual Sensor Networks: A
Survey,‖ ACM Computing Surveys, Vol.47, Issue 42, 2014, pp.1.

36

You might also like