You are on page 1of 66

FACE RECOGNITION SECURITY SYSTEM FOR ACCESS CONTROL

NUR ADILA BINTI MOHD RAZALI

UNIVERSITI TEKNOLOGI MALAYSIA

PSZ 19:16 (Pind. 1/07)

UNIVERSITI TEKNOLOGI MALAYSIA


DECLARATION OF THESIS / UNDERGRADUATE PROJECT REPORT AND COPYRIGHT
Authors full name : NUR ADILA BINTI MOHD RAZALI
Date of Birth
Title

: 22ND MAY 1991


: FACE RECOGNITION SECURITY SYSTEM FOR ACCESS CONTROL

I hereby declare that I have read this thesis and in my


opinion this thesis is sufficient in terms of scope and quality for the

Academic Session : 2013/2014

award of the Bachelors Degree of

I declare that this thesis is classified as:

Electrical
and Electronic
Engineering
(Instrumentation
& Control)
CONFIDENTIAL
(Contains
confidential
information under
the Official Secret Act
1972)*

RESTRICTED

(Contains restricted information as specified by the


organization where research was done)*

OPEN ACCESS

I agree that my thesis to be published as online open access


(full text)

Signature

I acknowledged that Universiti Teknologi Malaysia reserves the right as follows:

Name of Supervisor :

1. The thesis is the property of Universiti Teknologi Malaysia

Date

2. The Library of Universiti Teknologi Malaysia has the right to make copies for the
purpose of research only.
3. The Library has the right to make copies of the thesis for academic exchange.

Certified by:

SIGNATURE

SIGNATURE OF SUPERVISOR

NUR ADILA BINTI MOHD RAZALI

ASSOC. PROF.IR.DR HAZLINA BINTI


SELAMAT

(910522-14-5470)

NOTES:

If the thesis is CONFIDENTAL or RESTRICTED, please attach with the letter from
Date: 18 JUN 2014
Date: 18 JUN 2014
the organization with period and reasons for confidentiality or restriction.

I hereby declare that I have read this thesis and in my/our*


opinion this thesis is sufficient in terms of scope and quality for the
award of the degree of Bachelor of
Engineering (Instrumentation and Control)

Signature

: .........

Name of Supervisor : Assoc Prof.Ir.Dr Hazlina Binti Selamat


Date

: ..

FACE RECOGNITION SECURITY SYSTEM FOR ACCESS CONTROL

NUR ADILA BINTI MOHD RAZALI

A thesis submitted in fulfillment of the


requirements for the award of the degree of
Bachelor of Engineering (Electrical - Instrumentation and Control)

Faculty of Electrical Engineering


Universiti Teknologi Malaysia

JUNE 2014

ii

I declare that this thesis entitled Face Recognition Security System for
Acceess Control is the result of my own research except as cited in the
references.

Signature

: ....

Name of Candidate

: NUR ADILA BINTI MOHD RAZALI

Date

iii

Dedicated, in thankful appreciation for


Support, encouragement and understanding to
my beloved parents, Mohd Razali and Mazni
my sibling, and my friends
for their love and sacrifice

iv

ACKNOWLEDGMENT

First and foremost, praise be to Allah because of His love and strength that
He has given to me to complete my final year project entitled Face Recognition
Security System for Access Control. I do thank for His blessings in my daily life,
good health, healthy mind and good ideas although I have to go through some
difficulties along the way.

I would like to express my gratitude and appreciation to those who had


contributed to the completion of this project. First, I would like to dedicate a special
thanks to my supervisor, Assoc Prof Ir Dr Hazlina Selamat for the support, advices,
and experiences that I gained in completing my final year project.

Next, I would like to express my gratitude to Dr Mohd Amri Bin Md Yunus,


the final year project coordinator, for all the information and guidance given. Not to
forget, I would also like to acknowledge with much appreciation to my family
members for their concern, encouragement and understanding.

Finally, thanks to those who have contributed directly or indirectly to the


success of this project whom I have not mentioned their name specifically. Without
them, this project would not successful.

Thank You.

ABSTRACT

In recent years, security systems have become one of the most demanding
systems to secure our assets and protect our privacy. A more reliable security system
should be developed to avoid losses due to identity theft or fraud. Thus, a lot of
researches have been done in order to improve established security system,
especially systems that are based on human identification. Face recognition system is
widely used in human identification process due to its capability to measure and
subsequently identifies human identification especially for security purposes. The
aim of this project is to develop a real-life application of a security lock system using
a face recognition method. Principal Component Analysis (PCA) is selected for the
face recognition algorithm due to its fast response of recognition process and less
sensitive to noise and interference. A Graphical User Interface (GUI) is developed
for this system and the Arduino microcontroller is used to switch off the magnetic
door in response to positive face identification. USB serial communication is used to
interface between the GUI in MATLAB and Arduino UNO microcontroller as it
allows input data transmission from MATLAB to Arduino UNO microcontroller.
First, the image of the individual is captured using an integrated webcam. The
captured image is then transferred to the database developed in MATLAB. In this
stage, the captured image compares to the training image in the database to
determine the individual status. If the system recognizes the individual as an
authorized person, the signal will be sent to the Arduino UNO microcontroller and
used to grant access to an entry or not At the moment, the system gives 90% of
accuracy.

vi

ABSTRAK

Dalam tahun-tahun kebelakangan ini, sistem keselamatan telah menjadi salah


satu sistem yang paling dituntut untuk menjamin keselamatan aset sisamping
melindungi privasi kita. Satu sistem keselamatan yang lebih dipercayai harus
dibangunkan untuk mengelakkan kerugian akibat kecurian identiti atau penipuan.
Oleh itu, banyak kajian telah dilakukan untuk memperbaiki sistem keselamatan yang
sedia ada, terutama sistem yang berasaskan kepada pengenalan manusia. Sistem
pengecaman muka digunakan secara meluas dalam proses pengenalan manusia
kerana keupayaannya untuk mengukur dan kemudiannya mengenal pasti identiti
manusia terutamanya untuk tujuan keselamatan. Tujuan projek ini adalah untuk
membangunkan satu aplikasi kehidupan sebenar sistem kunci keselamatan dengan
menggunakan kaedah pengecaman muka. Analisis Komponen Utama (PCA) dipilih
untuk algoritma pengecaman muka kerana tindak balas yang cepat untuk proses
pengecaman dan kurang sensitif kepada bunyi dan gangguan. Pengguna grafik antara
muka (GUI) dibangunkan untuk sistem ini dan Arduino UNO mikropengawal
digunakan untuk mematikan pintu magnet sebagai tindak balas kepada pengenalan
muka yang positif. USB komunikasi bersiri digunakan untuk antara muka diantara
GUI dalam MATLAB dan Arduino UNO mikropengawal kerana ia membolehkan
penghantaran data input daripada MATLAB kepada Arduino UNO mikropengawal.
Pertama, imej individu itu ditangkap denagn menggunakan kamera web bersepadu.
Imej yang ditangkap kemudiannya dipindahkan ke pangkalan data yang dibangunkan
dalam MATLAB. Pada peringkat ini, imej yang ditangkap dibandingkan dengan imej
latihan di dalam pangkalan data untuk menentukan status individu. Jika sistem
mengiktiraf individu sebagai orang diberi kuasa, isyarat akan dihantar ke
mikropengawal Arduino dan digunakan untuk memberikan akses kepada entri atau
tidak Pada masa ini, sistem ini memberikan 90% ketepatan.

vii

TABLE OF CONTENTS

CHAPTER

TITLE

PAGE

TITLE

DECLARATION

ii

DEDICATION

iii

ACKNOWLEDGMENT

iv

ABSTRACT

ABSTRAK

vi

TABLE OF CONTENTS

vii

LIST OF TABLES

LIST OF FIGURES

xi

LIST OF ABBREVIATIONS

xii

LIST OF APPENDICES

xiii

INTRODUCTION
1.1

Background of.Project

1.2

Problem Statement

1.3

Project Objective

1.4

Project Scope

1.5

Significance of Project

1.6

Thesis Outline

LITERATURE REVIEW
2.1

Door Access Control System

viii

2.2

2.3

2.1.1 Password/Keypad System

2.1.2 Smart Card System

2.1.3 Biometric Control System

Biometric Technology

2.2.1 Face Recognition

11

Feature Extraction Algorithm in Face

11

Recognition

2.4

2.3.1 Principal Component Analysis

12

2.3.2 Linear Discriminant Analysis

13

Conclusion

14

METHODOLOGY
3.1

Introduction

15

3.2

Project Planning

15

3.3

Project Overview

17

3.4

Software Development

17

3.4.1 Image Acquisition

18

3.4.2 Pre Processing

18

3.4.3 Feature Extraction using PCA

19

Algorithm

3.5

3.4.4 Classification

22

Hardware Development using Arduino UNO

22

Microcontroller
3.6

Conclusion

24

RESULT AND DISCUSSION


4.1

Introduction

25

4.2

Background Parameter

27

4.3

Multi Train Image

28

4.4

Variation in Head Position

30

4.5

Conclusion

33

ix

CONCLUSION AND FUTURE WORK


5.1

Conclusion

35

5.2

Future Work

35

PROJECT MANAGEMENT
6.1

Introduction

37

6.2

Project Schedule

38

6.3

Cost Estimation

39

REFERENCES

41

APPENDICES A-B

43

LIST OF TABLES

TABLE

TITLE

PAGE

21

Comparison of various biometric technologies

10

4.1

The result of uncontrolled parameters.

26

4.2

The result of controlled background parameter

27

4.3

The result of using multi rain image in train

29

database
4.4

The result of the variation in head position

31

4.5

The summary of the analysis

33

6.1

Cost estimation of face recognition security

39

system
6.2

Cost estimation of RFID based security system

40

xi

LIST OF FIGURES

FIGURE

TITLE

PAGE

2.1

The example of magnetic door

2.2

The example of smart card system

2.3

Classification of biometric technology

3.1

Flowchart of the project planning

16

3.2

System overview

17

3.3

Steps of face recognition process

18

3.4

Working principle of PCA

20

3.5

The example of Arduino Microcontroller

23

4.1

The difference between uncontrolled and

27

controlled background
4.2 (a)

Single image per person in training database

29

4.2 (b)

Five images per person in training database

29

4.3

The variation in head position

31

4.4

The example of negative recognition

32

4.5

The example of positive recognition

32

4.6

Relationship between the accuracy rate of the

34

system and the condition of parameter


6.1

Project schedule

38

xii

LIST OF ABBREVIATIONS AND SYMBOLS

The mean of whole data in vector form

The image data after the mean is removed

Covariance matrix

Vector describing the face class

DLM

Dynamic Link Matching

EBGM

Elastic Bunch Graph Matching

ED

Euclidean Distance

GUI

Graphical User Interface

ID

Identification

LDA

Linear Discriminant Analysis

LED

Light Emitting Diode

MATLAB

Math Laboratory

PCA

Principal Component Analysis

RFID

Radio Frequency Identification

TTL

Transistor Transistor Logic

UART

Universal Asynchronous Receiver Transmitter

USB

Universal Serial Bus

Matrix composed of column vectors

xiii

LIST OF APPENDICES

APPENDIX

TITLE

PAGE

MATLAB source code

43

Schematic diagram of circuit connection.

50

CHAPTER 1

INTRODUCTION

1.1

Background of Project

In recent years, it is very important to have a reliable security system that can
secure our assets as well as to protect our privacy. The conventional security system
requires a person to use a key, identification (ID) card or password to access an area
such as home and office. However, the existing security system has several
weaknesses where it can be easily forged and stolen. Thus, the problems lead to an
increased in interest in biometric technology to provide a higher degree of security to
replace the conventional security system.

Face recognition is one of the most popular authentication methods in


biometric technology. It is the most natural means of biometric verification
compared to the other biometric verification, such as fingerprint, iris and voice
verification. Apart from that, the facial imaging has easy client acceptance and
makes face recognition universal.

The input of the system is a face image captured by the integrated webcam.
Once the face image is captured, it is then transferred into MATLAB programming
for the face recognition process. Next, the input face image will be compared to the
training image in the training database. The recognition process is done by using
Principal Component Analysis (PCA) algorithm.

The Arduino UNO microcontroller is used in the system to control the output
of the system which is magnetic door. If the system recognizes the subject as an
authorized person, the signal will be sent to the Arduino UNO microcontroller and
used to unlock the magnetic door. Conversely, if the subject is unrecognized, the
magnetic door will remain locked.

Face recognition is not restricted to the application of access control. It has a


broad range of potential application. The application is mainly in the fields of
biometric such as intruder detection, surveillance system and law enforcement.

1.2

Problem Statement

Security is an ultimate concern in our daily life. One of the most important
fields in security system is the access control which controls the entranceways of a
building or an area such as home and office. The security for access control is very
important as a high number of burglary cases were reported every year. Based on
statistics reported by the Royal Malaysia Police, 11,586 burglary cases were reported
from January 2013 until June 2013 [1]. The huge amount of burglary cases lead to a
huge amount of losses faced by the victims. The huge amount of losses emphasized
that the security system should not be taken lightly.

The conventional security system for access control is not reliable since it can
be forged and stolen. For example, the password and ID card can be easily breached
since the password can be divulged to an unauthorized user, and the ID card can be
stolen by an impostor [2]. Apart from that, the traditional security methods like keys
and ID card can be easily lost and misplaced.

Therefore, security system for access control should be modernized to


enhance the security purpose. A more reliable security system should be developed
to avoid greater loss. Biometric technology can be implemented in the security
system for access control as it offers a higher degree of security compared to the

conventional security system. From [3], biometrics is the most secure and convenient
authentication tool since it cannot be borrowed, stolen, or forgotten, and forging one
is practically impossible.

The system is developed using the PCA algorithm for the recognition
process. The PCA algorithm is selected as the main algorithm in face recognition
process due to the simplicity of realization and the speed of recognition with respect
to the other method. Besides, the efficiency of the system is increased as PCA
reduced the data dimension and operate in smaller dimension.

1.3

Project Objective

The objective of this project is to design a security system for access control
using a face recognition system. The specific objectives that have to be achieved are
as follows:

1.4

i.

To develop a security system based on face recognition.

ii.

To design a door access security system based on face recognition.

iii.

To design a face recognition security system using the PCA algorithm.

Project Scope

This project is divided into three main parts. The first part focus on the
research and literature review of the project. In this part, the theory, algorithm and
application of a security system based on face recognition was studied. A small
research on the previous face recognition project has been made in order to get an
idea of the working principle of the system.

The second part is based on the software programming. MATLAB has been
used to develop the database to implement face recognition system. Face recognition
system is developed in MATLAB using Computer Vision System Toolbox and
Image Processing Toolbox. PCA algorithm has been used as the main algorithm in
the process of face recognition.

The last part is based on the hardware development. The output or application
of this project is the magnetic door which is controlled by the Arduino UNO
microcontroller. The output depends on the result from recognition process. A
comparison is made between the input image and the training image in the training
database during the recognition process. The magnetic door will unlock if the system
recognizes the input image and vice versa.

1.5

Significance of Project

The main advantage of this project is a higher degree of security system for
access control system can be developed. The problem encounter with conventional
existing security system such as stolen of ID card and keys can be solved. By
implementing biometric technology based on face recognition system for access
control, the losses due to burglary cases can be reduced.

1.6

Thesis Outline

The first chapter is on the introduction of the project. A brief overview


regarding on the project has been discussed. It consists of the problem statements, the
objectives of the project, the scopes of the project, as well as the significance of the
project.

Chapter 2 consists of a literature review and a brief explanation of the


research. A comparison on the method and algorithm from various journals and other
references were made to choose the most accurate method in order to be able to reach
the objectives. This chapter also provides an overview of the algorithm and
components used in this project.

Chapter 3 discussed about the methodology and the approach used in the
project. It defines and illustrates the steps involved in developing the system. The
steps taken in software development as well as the hardware development are
discussed in details in this chapter.

In Chapter 4, it includes the results of the analysis that has been done. The
analysis is done to determine the accuracy rate of the system. The analysis is done by
adding challenging details such as background parameter, multi train image and
variation in head position.

Chapter 5 is for the discussion and the conclusion of the project. The
conclusion is made based on the objective of the project. Future recommendations
were also discussed for further improvement of the system.

Project management is discussed in chapter 6. Project details and cost


estimation are discussed in details. A simple comparison on the cost estimation
between the system that are based on face recognition and a system that are based on
RFID technology is done.

CHAPTER 2

LITERATURE REVIEW

2.1

Door Access Control System

Access control system is a restriction of access to property or buildings. It is


important to have a security system for access control in order to secure our assets
and privacy. Magnetic door can be used to replace the traditional door knob to
increase the level of security.

Figure 2.1: The example of magnetic door

The magnetic door lock which works according to the concept of


electromagnetism is composed of an electromagnet and armature plate. Typically the
electromagnet portion of the lock is attached to the door frame and a mating armature
plate is attached to the door to allow the two mechanisms to work efficiently
together. When the door is closed, the two components are in contact.

The design takes into account the concept where the current has allowed to
flow through the wire for the production of magnetic flux or magnetic power. The
door will keep locked as the produced power provides a necessary strength that keeps
the door from being opened. The magnetic flux causes the armature plate to attract to
the electromagnet. Thus, the locking action is created and securely locks the door.

The operation methods of magnetic door can be divided into three basic
operations. The first method involves the use of a keypad system such as passwords.
The system will lock and unlock with the numeric code. A smart card such as Radio
Frequency Identification (RFID) tag is used in the second operation method of
magnetic door which is typically used for business and commercial buildings. For the
last operation method, the magnetic door can be operated using biometrics
technologies such as thumb print and face recognition.

2.1.1

Password/ Keypad System

The most common form of system identification and authorization


mechanism is a password or keypad system. For higher assurance, the user needs to
change passwords frequently so that it cannot be guessed. The user can choose their
password in the consideration of its practicality. The password should be generated
properly and keep it as secret. This system can be considered as one of the weak
security system as the password can be easily forgotten or it can be hacked easily.
Thus, password or keypad based system is not really reliable for access control.

2.1.2

Smart Card System

Smart card allows the card owner to access the facility. A smart card can be
programmed to allow or deny access through specified doors or facility. It stores
protected information and the persons privileges. There are two types of smart card

either contact or contactless. The contactless smart card usually used the electronic
signal to transfer data while physical contact is used for communication in contact
based card. However, it has several weaknesses as the card can be easily lost, stolen
or damage if it is exposed to high electromagnetic field.

Figure 2.2: The example of smart card system

2.1.3

Biometric Control System

Biometric control system which is used for personal authentication utilizes a


persons features such as the fingerprint, voice and face which are unique for each
individual. The system identifies and verifies a person by their unique characteristics.
It offers a higher degree of security since the uses of a persons unique characteristics
make it difficult to impersonate by a stranger. There are various types of biometric
that can be used for access control system such as thumbprint, voice recognition and
face recognition. Each method can be categorized in term of usability and the level of
security as each method has their own particular characteristics.

2.2

Biometric Technology

Biometric technology, which is widely used in the application of security, is


a method of identification and verification based on human characteristics. Figure 2.3
shows the classification of biometric. Biometrics can be divided into two categories
which are physiological and behavioral characteristics. Common physiological
biometrics include face, fingerprint, hand, iris and DNA while behavioral
characteristic depends on the pattern of behavior such as voice, keystroke pattern and
signature.

Figure 2.3: Classification of biometric technology

Since each person has their own unique characteristics, security system based
on biometric technology is highly recommended. In [3], it is stated that biometrics
are the most secure and convenient authentication tool as it cannot be borrowed,
stolen or forgotten. Besides, by using biometric authentication method, it is easy to
check whether a person has several identities or not.

In Table 2.1 below shows a comparison of various biometric technologies,


according to the perception of [4]. The comparison is based on seven factors which
are the universality, distinctiveness, permanence, collectability, performance,
acceptability and circumvention. The rank is basically divided into three categories

10

as being low (L), medium (M) or high (H). A higher ranking indicates a good
performance while a lower ranking indicates a poor performance.

Circumvention

Acceptability

Performance

Collectability

Permanence

Distinctiveness

Identifier

Universality

Table 2.1: Comparison of various biometric technologies [4]

Face

Fingerprint

Signature

Voice

The requirements of the application domains will determine the applicability


of a specific biometric technique. For an access control security system, the system
should have a higher degree in universality, distinctiveness, permanence, and
performance. The universality of an identifier means that every person should have
the characteristics while the distinctiveness depends on the differences in
characteristics to distinguish each person. Meanwhile, the permanence factor can be
described as a stability of characteristics in a different time and environmental
conditions and the performance of an identifier is basically depends on the
identification accuracy and recognition time [5].

The face recognition method has a higher degree in universality and moderate
degree in permanence factor. Although for the distinctiveness and performance
factors of face recognition is relatively low, face recognition has higher usability and
security where less than 0.0001% failure to enroll and acquire rate [6]. Thus, based
on this point of view, face recognition method was selected in developing the
security system for access control.

11

2.2.1

Face Recognition

Face recognition system is a biometric identification and verification that use


a persons face as their corresponding input. The face recognition system is similar to
other biometric system such as fingerprint or voice recognition as ones face has
many unique structures and features. Face recognition is selected for the system
based on the considerations that facial imaging, being non-intrusive, has easy client
acceptance, apart from the fact that face recognition is the most natural means of
biometric identification of human beings [7].

The face recognition process consists of four main steps which are image
acquisition, preprocessing, features extraction and classification. Feature extraction is
the key step of any face recognition process. Feature extraction extracts the feature
vector and information which represent the face in the face image. Thus, feature
extraction is the most important step in face recognition.

The selection of features that represent the face image is done in feature
extraction step. There are two basic methods in feature selection of face recognition
as discussed in [8]. The first method used global features approach or holistic
approach while the second method used local features approach. Global features use
the pixel level information from the input face image as the main features while local
features use geometric relationship among features such as the distance between two
eyes and the size of the eyes itself [9].

2.3

Feature Extraction Algorithm in Face Recognition

There are numerous algorithms develop for feature extraction in face


recognition system. An algorithm for feature extraction is basically based on feature
selection method. Two typical global features algorithms are PCA and Linear

12

Discriminant Analysis (LDA) while Elastic Bunch Graph Matching (EBGM) and
Dynamic Link Matching (DLM) is based on local features method [10].

PCA is an overall statistical method on the face image where the objective is
to retain the most information about the original image by finding the set of most
representative projection vectors [11]. Meanwhile, LDA aims to find the subspace
that best discriminates different face classes between intra-personal classes and
extra-personal classes. Both PCA and LDA algorithms contribute in the reduction of
data.

2.3.1

Principal Component Analysis (PCA)

The Principal Component Analysis (PCA) is a method of projection to a


subspace and is widely used in pattern recognition [12]. PCA is used to re-express
the original data in lower dimension basis vector [13]. Therefore, the noise and
redundancy of the data are kept to a minimum and the data is described
economically.

Pattern recognition based on the Karhunen-Loeve expansion, Kirby and


Sirovich [14, 15] have shown that any particular face can be represented in terms of a
best coordinate system termed as eigenfaces. In face recognition,. PCA is used to
calculate the eigenfaces and find the vectors that best accounts for the distribution of
face images within the entire image space [16].

Typically, two phases are included in the PCA algorithm which are the
training phase and the classification phase. In the training phase, the eigenspace was
established from training samples and the training images are mapped to eigenspace
for classification. During the classification phase, an appropriate classifier is used to
classify when input is projected to the same eigenspace.

13

2.3.2

Linear Discriminant Analysis (LDA)

Linear Discriminant Analysis (LDA) is an algorithm used for decreasing data


dimension. The objective of LDA is to preserve as much of the class discriminating
information as possible. It is appearance-based technique which encodes
discriminatory information in a linear separable space which bases are not
necessarily orthogonal [17].

Rather than searching for information that best describe the data, LDA
searches for vectors in underlying space that best discriminate among classes. In
other words, LDA generates a linear combination of independent features that yields
the largest mean differences between the desired classes [13]. There are two class
scatter matrix in LDA. The image within-class scatter matrix or known as intrapersonal class and the image between-class scatter matrix.

Within-class scatter matrix or intra-personal class can be described as


different in variations of expression based on same individual while between-class
scatter matrix or extra-personal class can be described as differences in variations of
appearance due to different identity. The ratio of the data distance between intrapersonal classes must keep as small as possible. Conversely, the ratio of the data
distance between extra-personal classes must be maximized. Thus, at least two
training samples are required to calculate between-class scatter matrix, and withinclass scatter matrix [16].

In [18], it is stated that PCA can outperform LDA if the training data set is
small. PCA is a more suitable algorithm for access control since PCA gives faster
response of recognition compared to LDA. Besides, PCA also has the advantage of
simple computerization.

14

2.4

Conclusion

As a conclusion, after reviewing several thesis and paper work from previous
research, it can be concluded that biometrics based security system offers a higher
degree of security compared to the conventional security system. Face recognition
has an advantages of easy client acceptance and universality. For features extraction
algorithm in face recognition process, PCA is chosen due to its fast response in
recognition process as well as the low sensitivity to noise. Therefore, the system will
be developed based on face recognition method by using the PCA algorithm.

15

CHAPTER 3

METHODOLOGY

3.1

Introduction

The aim of this project is to develop a security system for access control
based on face recognition. This includes the study of development on biometric
technology, face recognition system and also the magnetic door theory. The
development of this project consists of three main parts. The first part is basically on
literature review followed by the software and hardware development.

3.2

Project Planning

As referred to Figure 3.1, the project development is started on literature


review where a small research on the theory, applications and algorithm on anything
that related to the face recognition system for security purpose had been done. It is an
important part in order to collect the information from published materials and
resources. The next part focuses on the software development where the face
recognition takes place in MATLAB programming followed by hardware
development of the project. The application of the system is the access control, thus a
magnetic door system is used as the output for the project.

16

Start

Literature review
Security system for access

Face recognition system

control
Development of database for
face recognition using PCA

Hardware development for


magnetic door using Arduino

Devices analysis based on


recognition rate

No
Acceptable?

Yes
Stop

Figure 3.1: Flowchart of the project planning

Design
improvement

17

3.3

Project Overview

Figure 3.2: System overview

Figure 3.2 shows an overview of the system. The input image which is
captured using integrated webcam is transferred to MATLAB programming for the
recognition process. The data from recognition process is used as the input for the
Arduino UNO microcontroller. If the system recognized the person or claim that the
person as an authorized person, the magnetic door will unlock. In contrast, if the
system did not recognize the person, the magnetic door will remain locked.

3.4

Software Development

In software development, the face recognition process is done in MATLAB.


The system is developed using Computer Vision Toolbox, Statistical and Image
Acquisition Toolbox. A Graphical User Interface (GUI) is developed to provide an
interface for interaction of electronics devices through graphical icons.

18

Figure 3.3 shows the main steps of face recognition process. The face
recognition process goes under image acquisition, preprocessing, feature extraction,
and classification stages.

Image
Acquisition

Pre
Processing

Feature
Extraction

Classification

Figure 3.3: Steps of face recognition process

3.4.1

Image Acquisition

First, in the image acquisition process, the input face image is captured via
integrated webcam. Once the input image is captured, the features information will
be extracted. The purpose of image acquisition is to seek and extract a region which
contains only the face.

3.4.2

Preprocessing

In preprocessing, the acquired image is resized to a specific size and


resolution. The image is resized to 180x200 pixels. Dimensionally reduction is done
by compressing the original features without destroying the important information
from the image. Noises are removed by filtering techniques.

19

3.4.3

Feature Extraction using PCA Algorithm

This system used global features approached for feature selection. Global
features approach weights each pixel equally regardless it is the face pixel or the
background pixel. This approach will encode the entire face and represent face as a
code point in higher dimensional image space [9].

Feature extraction algorithm extracts features of the data and creates new
features based on the transformation or a combination of the original data. In this
system, PCA algorithm is implemented for the feature extraction algorithm. The
PCA algorithm used eigenfaces to find a vector that best distribution of face images.

PCA is used for feature extraction and data reductions. The basic working
principle of PCA is to extract the characteristic of feature on the face and represent
the face in the linear combination. The principle component of face in the training set
is then calculated.

The principle component or eigenfaces are a set of eigenvector associated


with a particular eigenvalue. The vector called as eigenfaces are eigenvector of the
covariance matrix is corresponding to the original face images. PCA aims to find the
vector that best accounts for the distribution of face images within the entire image
space.

PCA algorithm is used to calculate the eigenfaces of the image. It includes


the calculation of the mean image in face space and the each face difference is
further computed from the mean. The difference is used to compute a covariance
matrix to reveal how much sets are correlated.

20

Figure 3.4 shows the working principle of the PCA algorithm as discussed in
[12].

Figure 3.4: Working principle of PCA [12].

In mathematical terms, the 2D facial image is converted from 2D array to 1D


dimensional vector. The image is centered by subtracting the mean image from
image vector.

21

(3.1)

(3.2)

From Equation 3.1 and Equation 3.2 above, is the mean of whole data in
vector form while

is the image data after the mean is removed. Next, the image

data are combined into data matrix and to create covariance matrix, by multiplying to
its transpose. The equation to create a covariance matrix is shown in the Equation
3.3.

(3.3)

In Equation 3.3, W is a matrix composed of column vectors. The eigenvector


of the covariance matrix is calculated. The greatest variance in the image is
represented by the eigenvector with the largest eigenvalue. The image data are then
projected into the eigenfaces space.

For the distance measure, the Euclidean Distance between the image data and
eigenfaces are calculated using Equation 3.4 where is a vector describing the face
class. An image with a minimum value of ED is recognized as the equivalent image.

||

||

(3.4)

To express the data noise and data redundancy quantitatively, a


covariance matrix should be introduced where it includes all the correlation
information on noise and redundancy of the data. The eigenvectors are derived from
the covariance matrix. The eigenspace is calculated by identifying the eigenvectors
of the covariance matrix derived from a set of facial images (vectors) [19].

22

The main advantages of the PCA are its low sensitivity to noise, the reduction
of the requirements of the memory and the capacity, and the increase in the
efficiency due to the operation in a space of smaller dimensions [12]. Even though
the PCA algorithm is sensitive to changes in illumination and facial expression,
however PCA algorithm has an advantage on real-time recognition.

3.4.4

Classification

The system used the Euclidean Distance (ED) method as the classifier. ED is
the nearest mean classifier which is commonly used for decision making rules. The
ED is obtained by calculating the distance between the test image and the training
image in the database. A minimum ED must be obtained in order to recognize the
expression of the input image.

The maximum value of ED between the test image and the training image is
set to 4.00 x1015. Thus, if the ED between two images is smaller than 4.00ex1015, the
system will recognize the identity of the person and gives an entry permission which
means the magnetic door will unlock. However, if the ED is higher than the value
that we have set earlier, the identity of the person will not recognize by the system
and the magnetic door will remain locked. Refer to Appendix A for the source code
of the project in software development.

3.5

Hardware Development using Arduino UNO Microcontroller

For hardware development, it will focus on the microcontroller used in the


system. The microcontroller used in this project is an Arduino UNO microcontroller.
The Arduino UNO microcontroller was used to control the lock and unlocking
process of magnetic door depends on the output of face recognition phase.

23

Arduino UNO mirocontroller is an open source hardware board that contains


everything to support the microcontroller such as 14 digital input/output pins, a
Universal Serial Bus (USB) connection, a power jack and reset button. Arduino
UNO microcontroller is based on ATmega328 and can be simply connected to a
computer with a USB cable provided [20].

The Arduino UNO microcontroller can be powered up either by using USB


connection or external power supply. To communicate with the computer, the
ATmega328 provides Universal Asynchronous Receiver Transmitter (UART) using
transistor-transistor logic circuit (TTL) (5V) serial communication which is available
on digital pins 0 and pins 1.

The Arduino UNO microcontroller provides 14 digital input/output pins


which operate at 5 volts. Basically, the digital pins default to inputs or the pins
configured to be in high impedance state. Each pin has an internal pull-up resistor
where it is disconnected by default of 20-50 k Ohms.

Figure 3.5: The example of Arduino UNO microcontroller

A simple circuit is designed for the output of the system. Electrical


components such as relay, transistor, resistor and Light Emitting Diode (LED) are
used in the circuit. Refer to Appendix B for the schematic diagram of the circuit
connection.

24

3.6

Conclusion

In a nutshell, PCA algorithm is used in feature extraction for face recognition


as it is not depending on facial expression, faster in computational time as well as
lower sensitivity to noise. Meanwhile, for the microcontroller, Arduino Uno
microcontroller is selected as it is easy to program, and quite cheap.

25

CHAPTER 4

RESULT AND DISCUSSION

4.1 Introduction

The objective of the analysis is to determine the rate of accuracy of the


system. The rate of accuracy can be defined as the ratio between the number of
successful recognition and the total number of recognition, which derives from the
comparison of the distance between two images [13]. The accuracy rate of the
system can be calculated from Equation 4.1 below.

(4.1)

The Euclidean Distance is set to 4.00x1015 as the highest value of distance for
the system to recognize the image. If two images of the same person have the
smallest distance, it is assumed as a successful recognition. The total number of the
recognition in this analysis has been fixed at 20 times.

Based on previous works, there are three main parameters that have been
considered in order to determine the rate of accuracy of the system. Three main
parameters that were analyzed are the background of the face image, the effect of
using multi train image in training database and the variation in head position. The
parameters were varied between uncontrolled condition and controlled conditions to

26

determine the effect on the accuracy rate of the system. The analysis is done using an
offline approach where the face image is used from available digital images.

Initially, the system is set up without controlling any parameter. The result of
the initial analysis is used as a reference. The objective is to determine the accuracy
rate of the system at the most uncontrolled condition. The result of the analysis is
tabulated in Table 4.1 and will be used as a reference.

Table 4.1: The result of uncontrolled parameters


Test Image
1

Euclidean Distance
4.8553 x1015

Status
Unmatched

3.7300 x1014

Matched

4.9989 x1015

Unmatched

6.1992 x1015

Unmatched

15

1.5455 x10

Matched

2.6281 x1015

Matched

6.3466 x1015

Unmatched

1.3194 x1014

Matched

4.9207 x1015

Unmatched

10

7.7431 x1015

Unmatched

11

5.4063 x1015

Unmatched

12

7.6222 x1013

Matched

13

6.9572 x1015

Unmatched

14

5.5884 x1015

Unmatched

15

14

1.1219 x10

Matched

16

8.8637 x1014

Matched

17

4.3427 x1015

Unmatched

18

6.3084 x1015

Unmatched

19

7.1160 x1014

Matched

20

5.4079 x1015

Unmatched

27

From the analysis, the system gives 40% of accuracy. The accuracy rate of
the system with uncontrolled parameters is not suitable for the application of access
control. The application of access control needs high rate of accuracy as the system
need to differentiate between authorized and unauthorized person to grant the access.
Thus, further analysis should be made to improve the accuracy rate of the system.

4.2.

Background parameters

For further analysis, the background parameter is changed from uncontrolled


conditions to controlled conditions. The number of training images in train database
is set for a single image per person and the variation in head position is set in
uncontrolled conditions. For uncontrolled background, the face image is taken with
some noises in the background, such as more than one face appeared in the image
while to set the background in controlled conditions, the image is taken in dark and
homogeneous background. The difference between uncontrolled and controlled
background is shown in Table 4.2.

Figure 4.1: The Difference between uncontrolled and controlled background.

Table 4.2: The results of controlled background parameter


Test Image
1

Euclidean Distance
4.7896 x1014

Status
Matched

2.7727 x1014

Matched

28

4.3043 x1015

Unmatched

6.6339 x1015

Unmatched

9.5630 x1015

Unmatched

1.7423 x1014

Matched

5.9310 x1015

Unmatched

4.3694 x1015

Unmatched

1.8985 x1015

Matched

10

1.9417 x1014

Matched

11

1.3298 x1015

Matched

12

1.1746 x1016

Unmatched

13

8.9135 x1015

Unmatched

14

2.3241 x1015

Matched

15

1.2424 x1014

Matched

16

1.3245 x1016

Unmatched

17

1.1746 x1016

Unmatched

18

2.2039 x1014

Matched

19

14

3.1594 x10

Matched

20

7.0347 x1013

Matched

With a controlled background parameter, the system has successfully


recognized 11 identities. It is shown that with controlled background parameters, the
accuracy rate of the system is increased from 40% to 55%.The accuracy rate of the
system is increased with controlled background parameter as the noise in the
background is reduced. Based on the result, we can conclude that the accuracy rate of
the system is higher with controlled parameter compared to the uncontrolled
parameter.

4.3 Multi Train Image

Next, the number of training image per person is increased from a single
image per person to 5 images per person in order to increase the accuracy rate of the

29

system. However, the parameter of variation in head position is kept in uncontrolled


condition. Figure 4.2 shows the difference in the number of training image per
person and Table 4.3 shows the results of the analysis on multi train image per
person in the training database with controlled background parameter.

Figure 4.2 (a): Single image per person in training database

Figure 4.2 (b): Five images per person in training database

Table 4.3: The result of using multi train image in training database
Test Image

Euclidean Distance

Status

4.2801 x1015

Unmatched

30

7.9862 x1013

Matched

4.7789 x1013

Matched

8.1918 x1013

Matched

1.0360 x1014

Matched

2.4710 x1014

Matched

3.2824 x1013

Matched

2.1673 x1014

Matched

2.5106 x1016

Unmatched

10

2.3328 x1014

Matched

11

8.7543 x1013

Matched

12

1.8824 x1013

Matched

13

5.2020 x1013

Matched

14

6.5377 x1015

Unmatched

15

1.3242 x1015

Unmatched

16

7.8020 x1012

Matched

17

1.1324 x1013

Matched

18

13

5.5738 x10

Matched

19

2.0821 x1013

Matched

20

4.7807 x1014

Unmatched

The system shows an increased in the rate of accuracy from 55% to 75%.
Thus, it is proven that the rate of accuracy of the system is proportional to the
number of training image per person in train database. The accuracy rate of the
system increased as the number of training image increased. Higher number of
training image provides more basis vector in the feature space and produce less
reconstruction errors.

4.4

Variations in Head Position

In order to increase the accuracy rate, the variation in position of the subject
should be minimized. For uncontrolled position, the head position of the subjects is

31

varied while in controlled conditions, the position of head of subjects is standardized


in an upright, frontal position with some tolerance of side movement. Figure 4.3
shows the uncontrolled and controlled position of the subjects head and the result of
the analysis is tabulated in Table 4.4.

Figure 4.3: The variation in head position

Table 4.4: The result of the variation in head position


Test Image

Euclidean Distance

Status

13

1.5234 x10

Matched

7.5828 x1013

Matched

1.7044 x1013

Matched

1.1007 x1014

Matched

3.0640 x1014

Matched

4.4032 x1015

Unmatched

4.4783 x1013

Matched

2.7927 x1013

Matched

1.1624 x1013

Matched

10

1.0612 x1013

Matched

11

13

2.3825 x10

Matched

12

2.3596 x1013

Matched

13

8.2604 x1012

Matched

14

2.9802 x1014

Matched

15

5.2091 x1015

Unmatched

16

3.8850 x1013

Matched

32

17

9.5354 x1013

Matched

18

1.8897 x1013

Matched

19

7.3886 x1013

Matched

20

1.3150 x1013

Matched

The accuracy rate of the system improved from 75% to 90% based on the
analysis. With a minor tolerance of side movement of the head position, the system
successfully recognized 18 identities. It shows that the head position of the subject is
one of the challenges in face recognition.

The example of negative recognition and positive recognition is shown in


Figure 4.4 and Figure 4.5. After recognition process, the data will be sent to Arduino
Uno microcontroller. Arduino Uno microcontroller will decide whether to unlock or
remain locked based on the recognition data.

Figure 4.4: The example of negative recognition

Figure 4.5: The example of positive recognition

33

4.5

Conclusion

For the conclusion, the system gives the lowest accuracy rate when all the
three parameters are in uncontrolled condition. By controlling the background
parameters, the accuracy rate increased from 40% to 55%. Besides, the rate of
accuracy of the system with the use of multi train image. Lastly, by reducing the
variation in head position also increased the accuracy rate of the system. The system
gives the highest accuracy which is 90% with all the parameters in controlled
conditions. The summary of the analysis is tabulated in Table 4.5.

Table 4.5: The summary of the analysis


Analysis

Parameter
Background

Multi Train

Accuracy Rate
Head Position

(%)

Image
1

Uncontrolled

Uncontrolled

Uncontrolled

40

Controlled

Uncontrolled

Uncontrolled

55

Controlled

Controlled

Uncontrolled

75

Controlled

Controlled

Controlled

90

Based on Table 4.5, the graph of the relationship between the accuracy rate of
the system and the condition of the parameters is plotted. The graph of the
relationship between the accuracy rate of the system and the condition of the
parameters is plotted in Figure 4.6.

34

Accuracy Rate of The System


100
80
60
Accuracy Rate

40
20
0
1

Figure 4.6: Relationship between the accuracy rate of the system and the condition
of parameter

35

CHAPTER 5

CONCLUSION

5.1

Conclusion

The analysis shows that the system gives a higher accuracy rate with
controlled background parameter compared to the uncontrolled background
parameter. Besides, the accuracy rate of the system is directly proportional to the
number of training image and as the variation in head position decrease, the accuracy
rate increase. Therefore, in order to get maximum accuracy rate of the system, all
parameters should be set in controlled conditions. The system gives the highest
accuracy rate with all parameters is in controlled condition which is 90%.

As a conclusion, PCA is a reliable algorithm to be used in face recognition


security system if the parameters are set in controlled conditions. The objective in
developing a face recognition security system for access control using PCA
algorithm is achieved.

5.2

Future Work

There are several problems occurs during the development of the system. The
main problem is the serial connection between MATLAB and Arduino UNO
microcontroller. Based on previous reading, the communication error is a common

36

problem when interfacing MATLAB and Arduino UNO microcontroller. The


Arduino UNO microcontroller is used in this project due to its simplicity, easy to
program and low cost controller. However, Arduino UNO microcontroller is not
suitable for continuous system since it is not capable to run for a long time and only
suits with a low capacity processor. Thus, it is recommended to use higher capacity
of Arduino microcontroller such as Arduino Duemilanove and Arduino Mega.

Next, to have a larger size of a database, an improvement of the algorithm


should be made. A combination of algorithm such as the combination of PCA and
LDA can be made to keep the accuracy rate high. A combination of algorithm also
makes the system more user-friendly since the improved algorithm makes the system
less sensitive to the challenging parameter.

37

CHAPTER 6

PROJECT MANAGEMENT

6.1

Introduction

Project management is one of the important elements in order to achieve all


project objectives and goals. Project management is the application of knowledge
where it helps in project planning, organizing and controlling resources. It is
important to ensure that the project is executed efficiently and effectively within the
prescribed time with the best use of all resources. In this project, research scope,
research time and research budget are the main constraints to meet the project
requirement. Thus, the project schedule has been tabulated in a Gantt chart for a
better guideline in time management as well as to track the project development.

Next, project budgeting is a process of cost estimation that approximate the


cost of the project. Cost estimation must be accurate as underestimation of cost and
resources can lead to project failure. Therefore, cost estimation is done to ensure that
the cost required is minimal without neglecting the project requirement. Therefore, a
market survey is carried out and the final cost is tabulated.

38

6.2

Project Schedule

Two semesters are given for the development of the project, including the
analysis and testing of the system. A Gantt chart on the details of work contribution

June

May

April

March

February

January

December

November

October

Activities

September

for the whole one year is shown in Figure 6.1 below:

Progress
Evaluation
Literature Review
Software
Development
Hardware
Development
Model Building
Analysis and
Troubleshooting
Thesis Write-up
Thesis submission
Figure 6.1: Project Schedule

Figure 6.1 shows that the progress discussion and literature review are done
throughout the two semesters. The literature review is very important as it justifies
the proposed methodology and the progress discussion is important to track the
project development so that it can be done within the prescribed time. Software
development is done from October to March while hardware development is done
from January to March. Next, it is followed by the building of the model, analysis
and troubleshooting of the system, writing the thesis as well as the thesis submission.

39

6.3

Cost Estimation

Table 6.1 shows the cost estimation for the hardware development of the
system. As the system requires a simple circuit for the hardware, thus the system is
developed within the budget given. Since only the prototype of the system is being
developed, cheaper components are used in this project without neglecting the
functions and criteria needed.

Table 6.1: Cost estimation of face recognition security system


Component Name

Quantity

Unit Price

Total

Arduino Uno-R3

RM58.00

RM58.00

80mm Magnetic Door Lock

RM70.00

RM70.00

Single SPDT Relay SRD

RM2.50

RM2.50

Green

RM0.20

RM0.20

LED Super Bright 5mm Red

RM0.20

RM0.20

Transistor 2N3904

RM0.40

RM0.40

Resistor 0.25W 5% (22OR)

RM0.05

RM0.10

Resistor 0.25W 5% (1K)

RM0.05

RM0.05

Single Core Cable

RM0.40

RM0.80

Donut Board Small 6x15cm

RM1.60

RM1.60

LED Super Bright 5mm

TOTAL

RM133.85

The cost estimation of the hardware development of the system is compared


to the cost estimation in developing the security system for access control using
another method. The cost estimation of security system for access control that are
based on RFID is discussed. The comparison is important to determine whether the
system developed is cost effective or not.

40

The cost estimation of a system that are based on RFID technology is shown
in Table 6.2.

Table 6.2: Cost estimation of RFID based security system


Component Name

Quantity

Unit Price

Total

RFID Card

RM3.50

RM3.50

RFID Reader RS232

RM135.00

RM135.00

Arduino Uno-R3

RM58.00

RM58.00

80mm Magnetic Door Lock

RM70.00

RM70.00

Single SPDT Relay SRD

RM2.50

RM2.50

Green

RM0.20

RM0.20

LED Super Bright 5mm Red

RM0.20

RM0.20

Transistor 2N3904

RM0.40

RM0.40

Resistor 0.25W 5% (22OR)

RM0.05

RM0.10

Resistor 0.25W 5% (1K)

RM0.05

RM0.05

Single Core Cable

RM0.40

RM0.80

Donut Board Small 6x15cm

RM1.60

RM1.60

LED Super Bright 5mm

TOTAL

RM272.35

Economic factors are an important consideration when choosing among


potential projects to be developed. From the result of the comparison, it is shown
that the system developed require a lower cost compared to the system that are based
on RFID technology. Therefore, a low cost security system for access control is
successfully developed using a biometric technology based on face recognition
method.

41

REFERENCES

1. Official Portal of Royal Malaysia Police, Statistik Jenayah Pecah Rumah JanJun 2013, Retrieved November 20, 2013 from www.rmp.gov.my
2. Nazeer, S.A., Omar, N., and Khalid, M. (2007). Face Recognition System using
Artificial Neural Networks Approach. International Conference on Signal
Processing, Communications and Networking. 22-24 February 2007. ICSCN.
2007. 420-425,
3. Liu, S., and Silverman, M. A Practical Guide to Biometric Security Technology,
IT Professional, (2001). 3(1): 27-32.
4. Jain, A. K., Ross, A., and Prabhakar, S. An Introduction to Biometric
Recognition. IEEE Transaction on Circuits and System for Video Technology.
(2004) 14(1): 4-20.
5. Faundez-Zanuy, M., Biometric Security Technology. IEEE Transaction on
Aerospace and Electronic System. (2006) 21(6): 15-26.
6. Committee of Hanvon. (n.d.). Face ID :FAQ. Retrieved October 27, 2013, from
http://www.hanvon.com/en/products/FaceID/downloads/FAQ.html
7. Kar, S., Hiremath, S., Joshi, D.G., Chadda, V.K, and Bajpai, A. A MultiAlgorithmic Face Recognition System. International Conference on Advanced
Computing and Communication. December 20-23, 2006 ADCOM 2006. 321326.
8. Agarwal, M., Agarwal, H., Jain, N., and Kumar, M., Face Recognition Using
Principle Component Analysis, Eigenface and Neural Network. International
Conference on Signal Acquisition and Processing. February 9-10, 2010. ICSAP
2010. 310-314.
9. Riddhi, C., and Neha, P., Details Study On 2D Face Recognition Technique
Using Local And Global Features. Indian Streams Research Journal. 2013.
3(2):1-17.

42

10. Juwei, L., Plataniotis, K.N, and Venetsanopoulos, A.N. Regularization Studies of
Linear Discriminant Analysis in Small Sample Size Scenarion with Application
to Face Recognition. Pattern Recognition Letter. 2005. 26(2): 181-191.
11. Xueguang, W., and Xiaowei, D. Study on Algorithm of Access Control System
Based on Face Recognition. International Colloquium on Control and
Management. August 8-9, 2009. ISECS. 2009. 336-338.
12. ark, M., and zen, F., A Face Recognition System Based on Eigenfaces
Method, Procedia Technology. 118-123; 2012
13. Chaoyang, Z., Zhaoxian, Z., Hua, S., and Fan, D. Comparison of Three Face
Recognition Algorithms. International Conference on Systems and Informatics.
May 19-20, 2012. ICSAI. 2012. 1896-1900.
14. Kirby, M., and Sirovich, L. Application of The Karhunen-Loeve Procedure for
The Characterization of Human Faces. IEEE Transaction on Pattern Analysis
and Machine Intelligence. 1990. 12(1): 103-108.
15. Sirovich, L. & Kirby, M. Low-Dimensional Procedure for the Characterization
of Human Faces, Journal of the Optical Society of America A. (1987). 4(3): 519524.
16. Lih-Heng, C., Aslleh, S.H., and Chee-Ming, T., PCA,LDA and Neural Network
for Face Identification IEEE Conference on Industrial Electronics and
Applications. May 25-27, 2009. ICIEA 2009. 1256-1259
17. Eleyan, A., and Demirel, H. PCA and LDA based Neural Networks for Human
Face Recognition. In: Delac, K., and Grgic, M. Face Recognition System.
Austria: I-Tech Education and Publishing. 93-106;2007Martinez, Aleix M.; Kak,
A.C., PCA versus LDA. IEEE Transactions on Pattern Analysis and Machine
Intelligence. 2001. 23(2): 228-233.
18. Martinez, Aleix M.; Kak, A.C., PCA versus LDA. IEEE Transactions on Pattern
Analysis and Machine Intelligence. 2001. 23(2): 228-233.
19. Kim K (2003) Face recognition using principal component analysis. Department
of Computer Science, University of Maryland,College Park
20. Arduino,

Arduino

UNO

Board,

Retrieved

http://arduino.cc/en/Main/arduinoBoardUno.

Disember

21,

2013

from

43

APPENDIX A

Source Code of Project

MATLAB Programming source code


Original version by Amir Hossein Omidvarnia, October 2007
Email: aomidvar@ece.ut.ac.

% Real Time Face Recognition System for Access Control


% Date : 10/4/2014

clear all;
close all;
clc;
a=arduino('com19');
a.pinMode(10,'output'); %% LED for positive recognition
a.pinMode(12,'output'); %% LED for negative recognition
a.pinMode(8,'output'); %% magnetic door lock
a.digitalWrite (10,0);
a.digitalWrite (11,0);
a.digitalWrite (12,0);
a.digitalWrite (8,1); % HIGH (1) = lock, LOW(0)=unlock

while (1==1)
choice=menu('FACE RECOGNITION FOR ACCESS CONTROL',.
'Recognize from Webcam',...
'Exit');

44

if (choice == 1) % 'Recognize from webcam' option from main menu

vid = videoinput('winvideo', 1, 'MJPG_320x240');


preview(vid);
choice1=menu('Capture Frame',...
'Capture & Compare ',

%%% (a)

'Capture & Save ',...

%%% (b)

'Exit

%%% (c)

');

Image = [];
if (choice1 == 1) % 'Capture' option from (a)
Image = getsnapshot(vid);
try
Image = imresize(Image,[200,180]);
testimage=fullfile('C:\Users\MissDidie\Desktop\complete\test
database\','1.jpg');
imwrite(Image,testimage);

% %%%%%%%%Paths for TrainDatabase and TestDatabase %%%%%%%%%


TrainDatabasePath ='C:\Users\MissDidie\Desktop\complete\train database';
TestDatabasePath ='C:\Users\MissDidie\Desktop\complete\test database';

%%%%%%%%%%%%%%% recall and compare %%%%%%%%%%%%%%%


TestImage = strcat(TestDatabasePath,'\','1.jpg');
im = imread(TestImage);

%%%%%%%%%%%%%%% Create Database (1) %%%%%%%%%%%%%%%


TrainFiles = dir(TrainDatabasePath);
Train_Number = 0;

for i = 1:size(TrainFiles,1)

45

if
not(strcmp(TrainFiles(i).name,'.')|strcmp(TrainFiles(i).name,'..')|strcmp(TrainFiles(i).
name,'Thumbs.db'))
Train_Number = Train_Number + 1; % Nol images in the training database
end
end

T = [];
for i = 1 : Train_Number
str = int2str(i);
str = strcat('\',str,'.jpg');
str = strcat(TrainDatabasePath,str);

img = imread(str);
img = rgb2gray(img);

[irow icol] = size(img);

temp = reshape(img',irow*icol,1);% Reshaping 2D -> 1D image


T = [T temp]; % 'T' grows after each turn
end

%%%%%%%%%%%%%%% Eigenface Core (2) %%%%%%%%%%%%%%%%


m = mean(T,2); % Computing the average face image
Train_Number = size(T,2);

A = [];
for i = 1 : Train_Number
temp = double(T(:,i)) - m;
A = [A temp]; % Merging all centered images
end

L = A'*A; % L is the surrogate of covariance matrix C=A*A'.

46

[V D] = eig(L);

L_eig_vec = [];
for i = 1 : size(V,2)
if( D(i,i)>1 )
L_eig_vec = [L_eig_vec V(:,i)];
end
end
Eigenfaces = A * L_eig_vec; % A: centered image vectors

%%%%%%%%%%%%%% Recognition (3) %%%%%%%%%%%%%%


global face;
face = 0;

ProjectedImages = [];
Train_Number = size(Eigenfaces,2);
for i = 1 : Train_Number
temp = Eigenfaces'*A(:,i); % Projection of centered images
ProjectedImages = [ProjectedImages temp];
end

InputImage = imread(TestImage);
temp = InputImage(:,:,1);

[irow icol] = size(temp);


InImage = reshape(temp',irow*icol,1);
Difference = double(InImage)-m; % Centered test image
ProjectedTestImage = Eigenfaces'*Difference; % Test image feature vector

Euc_dist = []; % ED
for i = 1 : Train_Number

47

q = ProjectedImages(:,i);
temp = ( norm( ProjectedTestImage - q ) )^2;
Euc_dist = [Euc_dist temp];
end

min(Euc_dist)
if(min(Euc_dist) <= 4.0000e+015)

face = 1; % match
a.digitalWrite (10,1);
a.digitalWrite (11,1);
a.digitalWrite (12,0);
a.digitalWrite (8,0);
pause(5);
a.digitalWrite (8,1);

end

if (min(Euc_dist) > 4.0000e+015)

face = 2; % unmatch
a.digitalWrite (10,0);
a.digitalWrite (11,0);
a.digitalWrite (12,1);
a.digitalWrite (8,1);
end

face
[Euc_dist_min , Recognized_index] = min(Euc_dist);
OutputName = strcat(int2str(Recognized_index),'.jpg');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SelectedImage = strcat(TrainDatabasePath,'\',OutputName);
SelectedImage = imread(SelectedImage);

48

CaptureImage = strcat(TestDatabasePath,'\','1.jpg');
ia = imread(CaptureImage);
figure,imshow(ia);
title('Capture Image');

imshow(im);
title('Test Image');
figure,imshow(SelectedImage);
title('Equivalent Image');

str = strcat('Matched image is : ',OutputName);


disp(str)

end
end
closepreview(vid);

if (choice1 == 2) %%%% 'Capture & Save' option from (a)


Image1 = getsnapshot(vid);
Image1 = imresize(Image1,[200,180]);
imshow(Image1);
title ('Save Image');

testimage1=fullfile('C:\Users\MissDidie\Desktop\analysis\train
database\','1.jpg');

imwrite(Image1,testimage1);

end
closepreview(vid);

if (choice1 == 3) %%% 'Exit' from main menu


clear choice1

49

end

end

if (choice == 2)
clear choice
return;
end;
end

50

APPENDIX B

Schematic Diagram of Circuit Connection

You might also like