Rescued Document
Rescued Document
RECOGNITION SYSTEM
BY
23EF050122299
OF COMPUTER SCIENCE.
MAY 2025
i
DECLARATION
I, NWANKWO KIZITO KOSISOCHUKWU, hereby declare that the project work titled Design
and Implementation of face detection and recognition system (A Case Study of Eby Oil Security
and Customer Identification Nigeria Ltd) is a record of an original work done by me, as a result of
my research effort carried out in the Faculty of Science and Technology, Department of Computer
Science, ESTAM University, Benin Republic, under the supervision of Engr. Raymond Ejem.
This work has not been previously submitted for any degree or diploma in any institution.
……………………….. ………………………
Nwankwo Kizito Kosisochukwu Signature/Date
ii
CERTIFICATION
This is to certify that this research project titled “Design and Implementation of Face Detection and
(23EF050122299) under the supervision of Engr. Raymond Ejem and has been prepared in
accordance with the regulations governing the preparation of projects in the Faculty of Science and
…………………… ……………………..
(B.Sc., M.Sc.,)
(Project Supervisor)
…………………………… …………………….
(B.Sc., M.Sc.)
(Head of Department)
……………………… …………………….
iii
DEDICATION
This project is dedicated to my parents, family lecturer guardians, mentors, and God. Their
unwavering support, encouragement, and guidance have been instrumental in my academic
journey.
iv
ACKNOWLEDMENT
I sincerely acknowledge the efforts and guidance of my supervisor, [ENGR RAYMOND], whose
patience, expertise, and constructive feedback were invaluable in the completion of this project.
I also extend my gratitude to the faculty and staff of the Department of Computer Science, [ESTAM
UNIVERSITY], for providing a conducive learning environment.
My heartfelt appreciation goes to my family, friends, and colleagues for their unwavering support,
encouragement, and motivation throughout this research work.
Above all, I thank God for the wisdom, strength, and perseverance to successfully complete this
project.
v
ABSTRACT
Face detection and recognition systems play a significant role in modern security
and authentication mechanisms. This project explores the design and
implementation of a computerized face detection and recognition system,
focusing on its application in security and identification. The system employs
OpenCV and deep learning models to accurately detect and recognize faces in
real-time. The methodology involves collecting image datasets, preprocessing
images, and implementing facial recognition algorithms using machine learning
techniques such as Principal Component Analysis (PCA), Local Binary Patterns
Histograms (LBPH), and Convolutional Neural Networks (CNNs). The project is
developed in Python using libraries like OpenCV, TensorFlow, and NumPy for
efficient image processing. The system is tested on a dataset of facial images,
achieving a high recognition accuracy rate. This work highlights the potential of
face recognition technology in security, authentication, and surveillance, while
also addressing challenges like lighting conditions, pose variations, and
computational efficiency. The study concludes with recommendations for
improving accuracy and real-time performance in future implementations.
Keywords: Face Detection, Face Recognition, OpenCV, Machine Learning,
Artificial Intelligence, Security Systems.
vi
RÉSUMÉ
La conception et la mise en œuvre d’un système de détection et de reconnaissance
faciale visent à améliorer la sécurité et l’authentification dans divers domaines,
notamment l’accès aux bâtiments, la surveillance et les systèmes informatiques.
Ce système utilise des algorithmes avancés de vision par ordinateur et
d’apprentissage profond pour identifier et authentifier les visages en temps réel.
Grâce à l'intégration de modèles CNN et d'OpenCV, le système capture, traite et
compare les images faciales avec une base de données préenregistrée, permettant
ainsi une reconnaissance rapide et fiable. Il dispose d’une interface utilisateur
intuitive pour enregistrer de nouveaux visages, gérer les accès et générer des
rapports détaillés sur les tentatives de reconnaissance. En automatisant
l’identification des individus, ce système renforce la sécurité, réduit le besoin de
surveillance manuelle et améliore l’efficacité des contrôles d’accès. Il peut être
utilisé dans des environnements tels que les entreprises, les institutions éducatives
et les applications domestiques intelligentes, garantissant ainsi une solution
moderne et fiable pour la gestion de l’identité et la surveillance.
vii
TABLE OF CONTENT
CONTENTS
DECLERATION…………………………………………………. I
CERTIFICATION ………………………………………………. II
ACKNOWLEDGEMENT ………………………………………. IV
ABSTRACT ……………………………………………………… V
RESUME …………………………………………………………. VI
CHAPTER ONE
1.0 Introduction
2.0 Introduction
viii
2.2 Review of related work
3.1 Introduction
4.1 Introduction
ix
4.4 Implementation details
CHAPTER FIVE
5.1 Summary
x
CHAPTER ONE 1.0 INTRODUCTION
videos. Face recognition is classified into three stages ie)Face detection, Feature
analysis. Face detection is an application for detecting object, analyzing the face,
understanding the localization of the face and face recognition. It is used in many
employed for detecting faces from image or from videos. The main goal of face
detection is to detect human faces from different images or videos. The face
detection algorithm converts the input images from a camera to binary pattern and
therefore the face location candidates using the AdaBoost Algorithm. The
proposed system explains regarding the face detection based system on AdaBoost
Algorithm . AdaBoost Algorithm selects the best set of Haar features and
implement in cascade to decrease the detection time .The proposed System for
face detection is intended by using Verilog and Model Sim, and also implemented
in FPGA.
Face Detection System is to detect the face from image or videos. To detect the
face from video or image is gigantic. In face recognition system the face detection
is the primary stage. Now Face Detection is in vital progress in the real world
1
Face recognition is a pattern recognition technique and one of the most important
system alone, the time factor is also considered a major factor in real time
solve the time problem, this architecture represented by multi-core CPUs and
many-core GPUs that provide the possibility to perform various tasks by parallel
proposes a Face Detection and Recognition System (FDRS). In doing so, this
research work provides the architectural design, detailed design, and four variant
Face recognition has gained substantial attention over in past decades due to its
surveillance. Modern facilities like hospitals, airports, banks and many more
another organizations are being equipped with security systems including face
2
research in this field to make facial recognition system faster and accurate. The
accuracy of any face recognition system strongly depends on the face detection
system. The stronger the face detection system the better the recognition system
would be. A face detection system can successfully detect human face from a
given image containing face/faces and from live video involving human presence.
The main methods used in these days for face detection are feature based and
image based. Feature based method separates human features like skin color and
facial features whereas image based method used some face patterns and
processed training images to distinguish between face and non faces. Feature
based method has been chosen because it is faster than image based method and
achieved through image processing. Locating the faces from images is not a
trivial task; because images not just contain human faces but also non-face objects
in clutter scenes. Moreover, there are other issues in face recognition like lighting
conditions, face orientations and skin colors. Due to these reasons, the accuracy
Face recognition is one of the most important biometrics methods. Despite the
fact that there are more reliable biometric recognition techniques such as
fingerprint and iris recognition, these techniques are intrusive and their success
3
depends highly on user cooperation. Therefore, face recognition seems to be the
most universal, nonintrusive, and accessible system. It is easy to use, can be used
efficiently for mass scanning, which is quite difficult, in case of other biometrics
the transmission of germs and impurities from other users. However, face
recognition is completely non-intrusive and does not carry any such health
dangers.
world, countries are considering these advantages and are shifting to new
4
security requirements. Unfortunately producers of biometric technologies do not
discussed. Since biometrics form the technology basis for large scale and very
Also, some other issues with face detection and recognition system is on
individual with identical face like identical twins and others, in situation like this
it is possible for the system to make mistake or error in processing the person
The objective of this project is to implement a face recognition system which first
detects the faces present in either single image frames; and then identifies the
particular person by comparing the detected face with image database or in the
In addition to the main objective of this research work, the researcher also went
far
more to add other features to the new system which are as fellow.
1. One of the objectives of this system is to design a system that will help the
5
organization maintain a strong security in the work environment.
3. Develop a ridged and secure database for the organization to enable them
work will help the users in maintaining data. This system will reduce the rate of
fraudulent activities as it can as well keep track of registered users and grant them
Also the knowledge that would be obtained from this research will assist the
management to grow, also this research work will also be of help to the upcoming
researcher in this field of study both with the academic students on their study.
The scope of this study covers only on face detection and recognition, accessing
previous records and making matched for the data, updating of records and
making
delete.
6
1.6 LIMITATION OF THE STUDY
the development of this project work to this extent. It was not an easy one, so
that are involved in this work is high in the sense that we all know that information
is money.
ii. TIME: A lot of time was involved in writing and developing this work, iii.
study.
dataset.
Flow Chart: A graphical picture of the logical steps and sequence involved in a
procedure or a program.
Normalization: A process of replacing a given file with its logical equivalent the
procedure.
8
CHAPTER TWO LITERATURE REVIEW 2.0 INTRODUCTION
This chapter focuses on the ongoing confronts in the field of the recognition and
study system architectural framework, challenges and the imaging concepts all
Face detection is the elementary step in the face recognition system and acts as a
stone to all facial analysis algorithms. Many algorithms exist to implement face
detection; each has its own weaknesses and strengths. The majority of these
algorithms suffer from the same difficulty; they are computationally expensive.
pixels for face detection is time consuming and hard to implement because of the
enormous diversity of shape and pigmentation in the human face. Viola and Jones
quickly detect any object, including human faces, using AdaBoost classifier
9
cascades that are based on Haar-like features and not pixels. Viola-Jones
under the Open Computer Vision Library (OpenCV) [8]. Viola-Jones detectors
can be trained to recognize any kind of a solid object, including human faces and
facial features such as eyes, and mouths. OpenCV has implemented Viola-Jones
INFORMATION MANAGEMENT
Data can be defined as individual facts or raw about something that can be
stimuli that have meaning in some contest for its receiver. When data is entered
Graham (2001) said, with the move from local application to a web based ones,
also the data we created and access will need to undergo some profound changes.
10
DATABASES
catalogs, inventories and item/customer records. They say that every business
would be a failure without a secure and reliable data management system. They
further say that information systems are the hearts of most businesses worldwide,
According to them. it is not easy to have a secure system, hut a system developer
must ensure that this is achieved. They advise system developers to have clear
subject areas, requirements and plans before they start designing the systems.
Advanced database systems were written by leading specialists who have made
According to Thierry (2006), the term database design can be used to describe
structure used to store data in are rational model these are the tables and views
However the database design could be sued to apply overall process of designing,
and not just base data structures, hut also forms and queries are used apart overall
11
2.2 EMPIRICAL STUDY .1 CHALLENGES IN FACE RECOGNITION
Over the years, face recognition has gained rapid success with the development
of new approaches and techniques. Due to this success, the rate of successful face
recognition has been increased to well above 90%. Despite of all this success, all
visibility. These challenges are lighting conditions variations, skin variations and
face angle variations. The challenges are explained in descriptive manner below.
The lighting conditions in which the pictures are taken are not always similar
because the variations in time and place. The example of lighting variations could
be the pictures taken inside the room and the pictures taken outside. Due to these
variations, a same person with similar facial expressions may appear differently
in different pictures. As a result, if the person has single image store in the
database of face recognition, matching could be difficult with the face detection
Another challenge for skin based face recognition system is the difference in the
skin color due to the difference in the races of the people. Due to this variation,
12
sometimes the true skin pixels are filtered out along with the noise present in an
filtered out during noise filtering process. So, it is a tough task is to choose the
filter which will cover the entire skin tones of different people and kick out false
skin noise.
The angle of the human face from camera can be different in different situations.
A frontal face detection algorithm can’t work on non-frontal faces present in the
image because the geometry of facial features in frontal view is always different
than the geometry of facial features in non-frontal view. This is why orientation
Image processing is a method of processing the image values, more precisely, the
the input image such that the output image may change parametrically such as in
colors and representation. Image processing is the basic part of the face
recognition involving digital images. The processing can change the image
13
representation from one color space to another color space. It can also assign
different color values to targeted pixels for the purpose of keeping areas of interest
components. Typical examples of color spaces are RGB, YCbCr and HSI color
spaces. In each of these color spaces the color of a pixel at any point in an image
is the combination of three color components. These color components vary from
0 to maximum value and this maximum value depends on the bits per pixel. The
different values in the range give different colors from black (0) to white (255)
RGB color space is the combination of red, green and blue color components.
For the 24 bits per pixel, the range of R, G and B varies from 0 to 255. If R, G
and B are all 0 then the resulted color will be black. If R, G and B are all 255
then the output color will be white. The concept of the RGB color space is
specified in figure 2.b.3. Here the x-axis represents blue color range, y-axis
represents green color range and Z-axis represents red color range. As explained
14
above, we can see that black color is represented at the origin and white color is
represented at the other corner where red, green and blue are 255 each. Similarly
Wayman has studied the technical testing of biometric devices and divided it into
decision. This makes the potential attack points more clear. introduces three more
15
extend. The level of supervision may vary for systems but it is not difficult to
imagine the related vulnerabilities. Vulnerabilities in this area may devalue even
the best planned system. A biometric system may or may not be related to an IT
environment may introduce some new vulnerabilities not existing in the previous
token. A token may introduce a potential attack point to the biometric system. A
kind of system. There are several other schemes for vulnerability classification
systems is suggested.
16
Fail secure: Result of abnormal utilization conditions of biometric system or IT
environment.
parameters is an example.
security level.
biometric data can be used for another type of attack (e.g. replay attack).
systems. Using the given list of them, vulnerabilities for specific systems can be
identified. A biometric system may not have all of the vulnerabilities or attack
17
points. The list is general enough and can be applied to any system easily. For a
identify the
vulnerabilities.
This section describes the architectural design of FDRS, involve: the Mono
start the real recognition. A face must be detected to increase the possibility of
recognition and speed up the process by choosing one location in the image. To
detect a face, two steps must be done before the recognition. The first step is to
resize the image to standard size (determine by the administrator), apply some
filter to increase the quality, and convert the image into a compatible form. Next,
go to detection face, such that the image required to recognize is uploaded in the
memory with an Extensible Markup Language (XML) file to detect a face, and
18
finally, go to recognition step. In recognition, the extracted face will be compared
with training faces when they uploading to memory and extract face features by
a recognition algorithm.
Any operating system (OS) has multiple ways to deal with a process for different
structures. Some process has a single thread and other has multithreads
architecture
module: This module compares the presented biometric sample with the template.
Decision module: This module accepts or rejects the user depending on the
19
Figure 1: Attack points of a biometric system
Ratha et.al. identify eight attack points in this scheme. Let us shortly describe
the system ignoring the sensor. For instance, replay of an old copy of a fingerprint
4. Spoofing the biometric feature: Features extracted from input signal are
or distant. The attacker tries to fake one or more biometric templates in the
denial of service.
8.Attacking the final decision process: If the final decision can be inserted or
blocked by the hacker then the authentication system function will be overridden.
integrated to the biometric system which possibly makes the biometric system
1. Operating systems;
1. management of operations;
21
2. management of parameters (especially FAR/FRR parameters );
3. system configuration.
In the parallel face recognition process, two tasks can be done simultaneously.
The process of uploading training face images in the memory and the process of
22
Figure 3. CPU Parallel Face Recognition
FDRS has been implemented in four implementation variants (i.e., CPU Mono,
CPU Parallel, Hybrid Mono and Hybrid Parallel. Fisher face algorithm is
23
tools involve Open Computer Vision (OpenCV) version 2.4.8, Microsoft .Net
of applying 400 images for 40 persons' faces (10 images per person), defining,
training, and recognizing these images on these four variants, the experiment is
taken place on the same environment (laptop computer Intel core i7 processor 2.2
GHz, Nvidia GPU GeForce GT 630M, 7GB RAM). The speed up factor is
measured with respect to the CPU Mono implementation (the slowest than all
other three variants). The practical results demonstrated that, the Hybrid Parallel
Recognition is the fastest algorithm variant among the all, because it gives an
overall speed up around (82) times. The CPU Parallel gives an overall speed up
around (71). Finally, the Hybrid Mono gives a little improvement about (1.04).
24
CHAPTER THREE SYSTEM ANALYSIS AND METHODOLOGY 3.1
INTRODUCTION
applying face detection algorithms (e.g., Haar cascades or deep learning models),
models.
Procedures used in data collection and information gathering are here, outlined
and analyzed. Data was carefully collated and objectively evaluated in order to
define as well as ultimately provide solutions to the problems for which the
During the research work, data collection was carried out in many places. In
gathering and collecting necessary data and information needed for system
analysis, two major fact-finding techniques were used in this work and they are:
a. Primary source
25
Primary source refers to the sources of collecting original data in which the
questionnaires.
This involved series of orally conducted interviews with some select users. Also,
some users were interviewed with a view to getting information about their
Secondary Source:
Perusals through online journals and e-books as well as visits to relevant websites,
26
3.4 FILE MAINTENANCE ERROR HANDLING MODULE
The researcher too time to design an error handling module for the new system
cases. This module design handles exception in sequence so that each of the unit
try’s to handle the error, which if could not be handled by all the units, runs as an
outbound error
27
A system architecture can comprise system components, the externally visible
them. It can provide a plan from which products can be procured, and systems
developed, that will work together to implement the overall system. There have
Process architecture is the structural design of general process systems and applies
complexity.
Processes are defined as having inputs, outputs and the energy required to
passage of time: a process takes real time to perform its associated action. A
process also requires space for input/output objects and transforming objects to
processes. Complex processes are made up of several processes that are in turn
28
abstraction. If the process system is studied hierarchically, it is easier to
The internal architectural design of computers differs from one system model to
another. However, the basic organization remains the same for all computer
systems. The following five units (also called "The functional units") correspond
to the five
29
Input Unit
Data and instructions must enter the computer system before any computation can
be performed on the supplied data. The input unit that links the external
environment with the computer system performs this task. Data and instructions
enter input units in forms that depend upon the particular device used. For
example, data is entered from a keyboard in a manner similar to typing, and this
differs from the way in which data is entered through a mouse, which is another
type of input device. However, regardless of the form in which they receive their
inputs, all input devices must provide a computer with data that are transformed
into the binary codes that the primary memory of the computer is designed to
1. It accepts (or reads) the list of instructions and data from the outside world.
30
3. It supplies the converted instructions and data to the computer system for
further processing.
Output Unit
The job of an output unit is just the reverse of that of an input unit. It supplied
information and results of computation to the outside world. Thus it links the
computer with the external environment. As computers work with binary code,
the results produced are also in the binary form. Hence, before supplying the
1. It accepts the results produced by the computer which are in coded form
and
Storage Unit
The data and instructions that are entered into the computer system through input
units have to be stored inside the computer before the actual processing starts.
31
Similarly, the results produced by the computer after processing must also be kept
somewhere inside the computer system before being passed on to the output units.
preserved for ongoing processing. The Storage Unit or the primary / main storage
storing data and instructions, space for intermediate results and also space for the
final results.
1. All the data to be processed and the instruction required for processing
activities and actions with support for choice, iteration and concurrency. In the
Unified Modeling Language (UML), activity diagrams are intended to model both
show the overall flow of control. In FDRS, the main activity is the training phase
and the other one is the recognition phase. The activity diagram for the training
32
phase is shown in Figure 1, and the corresponding steps' activities are tabulated
in Table 1. Similarly, the activity diagram for the recognition phase is shown in
Figure 2, and the corresponding steps' activities are tabulated in Table 2. Also, the
the training and the recognition phases are shown in Figure 3 and Figure 4
respectively.
33
Figure 2. Activity Diagram of Recognition Phase
5 Create file in a hard disk to new image and save the image path and
34
1 Sends Image from folder to start the module work.
face and remove other parts of image, then the result is returned to
CPU.
4 Load train images from DB to RAM and extract features from them
in parallel. Next, the CPU extracts the face features from new face and
compares with other face features of the training images.
35
3.8 PROGRAM FLOW CHAT/DIAGRAM
Access database was used in storing the information used in this project. The
database was integrated into the system that the program access and update the
files.
Table design
Field Name Type Size
Id Int 11
Sex text 12
36
Image Object 10
Aga Integer 2
37
3.10 SYSTEM FLOWCHARTS
Face detection is the process of finding the human face from image and, if present,
returning the location of it. It is the special case of the object detection. Objects
can be anything present in the image including human and non human things like
trees, buildings, car and the chair. But, other than a human being itself objects
are least likely utilized in advanced applications. So, to find and locate the human
However, to locate the face is not an easy task in the image since images do not
contain only faces but other objects too. Moreover, some of the scenes’ are very
complex and to filter out the unwanted information is remain the tough task.
38
When the presence and the location of the face is found than this information is
detection rate of image face detection system. Face detection from an image can
be done by two methods named image based and feature based. Image Based
methods
treats the whole image as the group of patterns and so each region is classified as
the face or non-face. In this method a window is scanned against the parts of the
image. On every scan the output is computed and the threshold value is compared
with the output value of the window on current part of the image. If it is above
than the threshold value then that current part of the image is considered as the
face. The size of this window is fixed and chosen according to some experiments
with the help of training images size. The advantage of image based methods is
the higher percentage of face detection hit rate; however it is slow in terms of
networks are the two examples of image based approach. In feature based
methods features such as skin color, eyes, nose and mouth are separated first from
the rest of the image regions. With the extraction of these features the non-
39
interested regions of the image are not required to process further and therefore
the processing time is significantly reduced. In feature based methods the skin
color pixels are separated first because the color processing is faster which results
in the separation of other features. The advantage of the feature based methods
is the fast results but less accurate than image based methods. Another advantage
In the project, the feature based method is implemented. The initial step is to get
the image as input and then feature based algorithm is applied to detect the face
or faces.
Once the face region is determined the next is to mark the boundary around it.
40
CHAPTER FOUR SYSTEM IMPLEMENTATION AND TESTING
This chapter details the implementation of the face detection and recognition
system. The system was developed using Python and OpenCV, a powerful
computer vision library. The implementation process involved collecting facial
data, training the recognition model, and real-time face recognition through a
webcam interface.
1. Data Collection – capturing face images from the webcam and storing
them.
2. Model Training – training the LBPH (Local Binary Pattern Histogram)
recognizer.
3. Real-time Recognition – identifying faces and labeling them in real-time.
language with extensive support for image processing and computer vision
libraries. The OpenCV (Open Source Computer Vision) library was used for
image capture, face detection, and recognition due to its efficiency and support
Advantages of Python:
• Output 1: During data collection, face images are saved in the dataset
directory as User.ID.sample#.jpg.
• Output 2: After training, a model file trainer.yml is generated and
stored.
• Output 3: During real-time recognition, detected faces are displayed with
bounding boxes and labels (“User X” or “Unknown”) depending on
recognition accuracy.
42
Software Version
Operating System Windows 10 or higher
Python Interpreter Python 3.8 or higher
OpenCV OpenCV 4.x
NumPy NumPy 1.19+
Visual Studio Code Latest Version
4.5 CODING
• Data collection was tested by capturing various facial positions and lighting
conditions.
• Model training was verified by ensuring trainer.yml is generated.
• Real-time recognition was tested with multiple users and verified for
accuracy.
4.7.2 Testing
1. Unit Testing: Each function (face detection, image saving, recognition) was
tested independently.
2. Integration Testing: Ensured seamless interaction between data collection,
training, and recognition modules.
3. System Testing: The complete system was tested to validate functionality
under real-world conditions.
43
4.6 LEVELS OF TESTING FLOW CHART
Fig 4.6.1: Unit Testing
Unit testing focuses verification effort on the smallest unit of software i.e. the
module. Using the detailed design and the process specification testing is done to
uncover errors within the boundary of the module. All modules must be successful
in the unit test before the start of the integration testing begins. In this project each
The system was integrated and tested with multiple users, ensuring accurate
detection and correct labeling. The model successfully differentiated known users
Here the entire software system is tested. The reference document for this process
is the requirements document, and the goal as to see if software meets its
requirements. Here entire computerized banking system has been tested against
44
4.6.3 Database Implementation
dataset directory. Each image is labeled with a user ID to track user identity.
User Guide
45
2. Collecting Data:
a. Select option 1.
b. Enter a numeric User ID.
c. Position face in front of the camera until 20 samples are collected.
3. Training Model:
a. Select option 2.
b. The system will train and save trainer.yml.
4. Recognition:
a. Select option 3.
b. The camera detects and identifies known faces.
processing and has gained rapid success for over 30 years. Basically, the face
detection system locates the face present in the image and after comparing with
the database, if present, the identity of that person is revealed. For this purpose,
The location of the database is set in the recognition system so that each and every
image present in the database gets searched. If there is a match then the image is
taken from the database and display at the output along with the face detected
image. In addition, the name of the matching person will also be displayed. On
46
the other hand, if there is no hit then image is not displayed and a no match
The method used in the recognition is the Image Search method. It simply takes
an input image where a face was found and a directory of images as input. A
signature is calculated for the input image. Then for each image in the search
to assign a unique value to each image based on the contents of the image. A
distance is then calculated for each image in the search directory in relation to the
input image. The distance is the difference between the signature of the source
image and the signature of the image it is being checking against. The image with
the smallest distance is returned as the matching image and displayed at the
output.
5.2 CONCLUSION
The image face detection is implemented first and then the same system is used
to detect from video sources. The recognition system has also been implemented
on the image files. The accuracy of the system is achieved above 80%. The
project is good at the pictures of the people of different races and colors. The
project is good to detect the frontal faces present in the images files but not able
to detect the sideviews faces. The failure of detection on the pictures with very
47
dark backgrounds colors are also the limitation of the system just like other
of image processing and the steps required for any successful face detection. The
advancement can be achieved as the future goal to make most parts of the project
5.3 RECOMMENDATION
The end of this research work the researcher, finds this work interesting and
researcher recommends that any other work to be carried out on this topic the
current researcher should consider adding a real time facial recognition and voice
cam.release()
cv2.destroyAllWindows()
49
-------- STEP 2: Train Recognizer --------
def train_recognizer(): image_paths = [os.path.join(dataset_path, f) for f in
os.listdir(dataset_path)] face_samples = [] ids = []
recognizer.train(face_samples, np.array(ids))
recognizer.write('trainer.yml')
print("[INFO] Training completed and model saved!")
50
label = f"User {id}" if confidence < 70 else
"Unknown"
cv2.putText(frame, label, (x, y-10),
cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 255, 0) if label !=
"Unknown" else (0, 0, 255), 2)
cv2.rectangle(frame, (x, y), (x + w, y + h), (0,
255,
0) if label != "Unknown" else (0, 0, 255), 2)
cam.release()
cv2.destroyAllWindows()
51