KoneruLakshmaiah Education Foundation
(Deemed to be University)
DEPARTMENT OF ELECTRICAL
AND ELECTRONICS ENGINNERING
A Project Based Lab Report
On
MATLAB based project on face detection system
SUBMITTED BY:
NAME IDNO
P.TARUN KUMAR 180060029
V.SRI RAM 180069030
UNDER THE GUIDANCE OF
DR.K P PRASAD RAO
KL UNIVERSITY
Green fields, Vaddeswaram – 522 502
Guntur Dt., AP, India.
1
DEPARTMENT OF ELECTRICAL
AND ELETRONICS ENGINEERING
CERTIFICATE
This is to certify that the project based laboratory report entitled
that “MATLAB based project on face detection system” submitted by MR.P
TARUN KUMAR, MR.V SRI RAM bearing Regd. No.180060029,180069030 to the
Department of ELECTRICAL AND ELECTRONICS Engineering, KL University in
partial fulfillment of the requirements for the completion of a project based
Laboratory in “Technical skills IV (MATLAB)”course in II B Tech II Semester, is a
bonafide record of the work carried out by him under my supervision during the
academic year 2019 – 2020.
PROJECT SUPERVISOR HEAD OF THEDEPARTMENT
Dr. K P PRASAD RAO DR. S.V.N.LALITHA
2
ACKNOWLEDGEMENTS
It is great pleasure for me to express my gratitude to our honorable
President Sri. KoneruSatyanarayana, for giving the opportunity and platform
with facilities in accomplishing the project based laboratory report.
I express the sincere gratitude to our principal ProfDr.K. SUBBA RAO for
his administration towards our academic growth.
I express sincere gratitude to HOD-EEEDr.S.V.N.LALITHAfor his leadership
and constant motivation provided in successful completion of our academic
semester. I record it as my privilege to deeply thank for providing us the efficient
faculty and facilities to make our ideas into reality.
I express my sincere thanks to our project supervisor DR.K P PRASAD RAO
for his novel association of ideas, encouragement, appreciation and intellectual
zeal which motivated us to venture this project successfully.
Finally, it is pleased to acknowledge the indebtedness to all those who
devoted themselves directly or indirectly to make this project report success.
Name: P.TARUN KUMAR
V.SRI RAM
Regd . No:180060029
180069030
3
ABSTRACT
Face detection is an easy and simple task for humans, but not
so for computers. Face detection is the process of identifying
one or more human faces in images or videos. It plays an
important part in many biometric, security and surveillance
systems, as well as image and video indexing systems. There
are different types of algorithms used in face detection. Here,
we have used Viola-Jones algorithm for face detection using
MATLAB program. This include detection of not only face but
also eyes and upper body. In order to detect above things we
use different commands in it. While initially a form of
computer application, it has seen wider uses in recent times on
mobile platforms and in other forms of technology, such as
robotics. It is typically used as access control in security
systems and can be compared to other biometrics and face and
eyes recognition systems. Although the accuracy of facial
recognition system as a biometric technology is lower than iris
recognition and fingerprint recognition, it is widely adopted due
to its contactless and non-invasive process.
4
INDEX
S.NO TITLE PAGE NO
1 Introduction 6
2 Aim of the Project 8
3 Apparatus 9
4 Procedure 10
5 Matlab Implementation 12
6 Output screen shorts 13
7 Advantages and disadvantages 15
8 Conclusion 16
9 References 17
5
INTRODUCTION
Object detection and tracking are important in many computer vision
applications, including activity recognition, automotive safety and surveillance.
Presented here is an face detection using MATLAB system that can detect not only a
human face but also eyes and upper body.
Face detection is an easy and simple task for humans, but not so for computers. It
has been regarded as the most complex and challenging problem in the field of computer
vision due to large intra-class variations caused by the changes in facial appearance,
lighting and expression. Such variations result in the face distribution to be highly
nonlinear and complex in any space that is linear to the original image space.
Face detection is the process of identifying one or more human faces in images or
videos. It plays an important part in many biometric, security and surveillance systems,
as well as image and video indexing systems.
This face detection using MATLAB program can be used to detect a face, eyes
and upper body on pressing the corresponding buttons.
This real-time face detection program is developed using MATLAB version
R2012a. A graphic user interface (GUI) allows users to perform tasks interactively
through controls like switches and sliders. You can easily create a GUI and run it in
MATLAB or as a stand-alone application. The program output screen is shown in Fig. 1.
6
Fig: 1
VIOLA-JONES ALGORITHM
There are different types of algorithms used in face
detection. Here, we have used Viola-Jones algorithm for face
detection using MATLAB program. This algorithm works in
following steps:
1. Creates a detector object using Viola-Jones algorithm
2. Takes the image from the video
3. Detects features
4. Annotates the detected features
7
AIM
The main aim of this project is to generate face recognition using
MATLAB based on appropriate code.
Face recognition is the process of identifying one or more people in
images or videos by analyzing and comparing patterns. Algorithms for
face recognition typically extract facial features and compare them to a
database to find the best match. Face recognition is an important part of
many biometric, security, and surveillance systems, as well as image
and video indexing systems.
8
APPARATUS
MATLB VERSIONS OF:
1. 2012Ra
2. 2018Ra
>Command window
>editor window
>run
>saving the code of loading the data sheet in file
>saving implementation code in another file
9
Procedure
Step 1: Preparing Data-set for Face Recognition using
Matlab
I have prepared a dataset of 40 people. Each of these people
has 10 images with different poses. That means in total there
are 40 x 10 = 400 images. For every individual, there is
separate folders. Explaining it in this way will create
confusion.
Step 2: Loading the Dataset for Face Recognition
function output_value = load_database();
persistent loaded;
persistent numeric_Image;
if(isempty(loaded))
all_Images = zeros(10304,40);
for i=1:40
cd(strcat('s',num2str(i)));
for j=1:10
image_Container = imread(strcat(num2str(j),'.pgm'));
10
all_Images(:,(i-
1)*10+j)=reshape(image_Container,size(image_Container,1)*
size(image_Container,2),1);
end
display('Doading Database');
cd ..
end
numeric_Image = uint8(all_Images);
end
loaded = 1;
output_value = numeric_Image;
11
MATLAB IMPLEMENTATION
loaded_Image=load_database();
random_Index=round(400*rand(1,1));
random_Image=loaded_Image(:,random_Index);
rest_of_the_images=loaded_Image(:,[1:random_Index-1
random_Index+1:end]);
image_Signature=20;
white_Image=uint8(ones(1,size(rest_of_the_images,2)));
mean_value=uint8(mean(rest_of_the_images,2));
mean_Removed=rest_of_the_images-
uint8(single(mean_value)*single(white_Image));
L=single(mean_Removed)'*single(mean_Removed);
[V,D]=eig(L);
V=single(mean_Removed)*V;
V=V(:,end:-1:end-(image_Signature-1));
all_image_Signatire=zeros(size(rest_of_the_images,2),image_Signature);
for i=1:size(rest_of_the_images,2);
all_image_Signatire(i,:)=single(mean_Removed(:,i))'*V;
end
subplot(121);
imshow(reshape(random_Image,112,92));
title('Looking for this Face','FontWeight','bold','Fontsize',16,'color','red');
subplot(122);
p=random_Image-mean_value;
s=single(p)'*V;
z=[];
for i=1:size(rest_of_the_images,2)
z=[z,norm(all_image_Signatire(i,:)-s,2)];
if(rem(i,20)==0),imshow(reshape(rest_of_the_images(:,i),112,92)),end;
drawnow;
end
[a,i]=min(z);
subplot(122);
imshow(reshape(rest_of_the_images(:,i),112,92));
title('Recognition Completed','FontWeight','bold','Fontsize',16,'color','red');
12
Screen Shots:
13
14
> Advantages
1. Safety
2. fast and accurate
3. security
4. Fully automated
5. Cost efficiency
➢ Dis advantages
. 1. Surveillance Angle
2. Data Storage
3. High Implementation Costs
. 4. Legislation
15
CONCLUSION
Face recognition is still a challenging problem in
the field of computer vision. It has received a
great deal of attention over the past years
because of its several applications in various
domains. Although there is strong research
effort in this area, face recognition systems are
far from ideal to perform adequately in all
situations form real world. Paper presented a
brief survey of issues methods and applications
in area of face recognition. There is much work
to be done in order to realise methods that
reflect how humans recognise faces and
optimally make use of the temporal evolution of
the appearance of the face for recognition.
16
REFERENCES
1) https://www.mathworks.com/discovery/face-recognition.html
2) https://www.mathworks.com/help/vision/examples/face-
detection-and-tracking-using-the-klt-algorithm.html
3) https://www.electronicsforu.com/electronics-
projects/software-projects-ideas/real-time-face-detection-
using-matlab
4) https://www.mathworks.in/matlabcentral/fileexchange/36855-
face-parts-detection
17
18