0% found this document useful (0 votes)
44 views20 pages

Oodp Project Report

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views20 pages

Oodp Project Report

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 20

FACE RECOGNITION SYSTEM

21CSC101T/OBJECT ORIENTED DESIGN AND PROGRAMMING

PROJECT REPORT

Submitted by

SYED SHAHABUDEEN RA2311027020043

NAVEEED FARHAN RA2311027020047

SIDDARTH RA2311027020050
Under the guidance of

Mrs. AISHWARYA
(Assistant Professor, Department of Computer Science
and Engineering)

II SEMESTER/I YEAR

COMPUTER SCIENCE AND ENGINEERING

FACULTY OF ENGINEERING AND TECHNOLOGY

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY RAMAPURAM,


CHENNAI
APRIL 2024

1
SRM INSTITUTE OF SCIENCE AND TECHNOLOGY
(Deemed to be University U/S 3 of UGC Act, 1956)

BONAFIDE CERTIFICATE

Certified that this project report titled FACE RECOGNITION SYSTEM is the bonafide
work of SYED SHAHABUDEEN (RA2311027020043), NAVEED FARHAN
(RA2311027020047) and SIDDARTH (RA2311027020050), who carried out the
project work under my supervision. This project work confirms to 21CSC101T
/Object Oriented Design and Programmig, II Semester, I year, 2024.

SIGNATURE

Mrs.AISHWARYA

Assistant Professor
Computer Science and Engineering,
SRM Institute of Science and Technology,
Ramapuram, Chennai.

2
SRM INSTITUTE OF SCIENCE AND TECHNOLOGY
RAMAPURAM, CHENNAI

DECLARATION

We hereby declare that the entire work contained in this project report titled
“FACE RECOGNITION SYSTEM” has been carried out by SYED SHAHABUDEEN (REG
NO:RA2311027020043), NAVEED FARHAN (REG NO: RA2311027020047), SIDDARTH (REG

NO:RA2311027020050) at SRM Institute of Science and Technology, Ramapuram,


Chennai, under the guidance of Dr. S. DEEPA, Assistant professor, Department of
Computer Science and Engineering.

Place: Chennai SYED SHAHABUDEEN


Date: NAVEED FARHAN
SIDDARTH

3
INTRODUCTION
Imagine a program that can identify your friends in a video call, or unlock
your phone with a simple glance! This is the power of face recognition
technology.

In this C++ project, you'll be venturing into the exciting realm of computer
vision by building a face recognition system. You'll use powerful libraries
like OpenCV to accomplish this feat.

Here's a glimpse of what your program will be able to do:

● Detect Faces: It will be able to pinpoint the location of faces within an


image or video frame.
● Extract Features: Once a face is found, the program will analyze it to
extract distinct characteristics, like the distance between the eyes or
the shape of the jawline.
● Recognition: By comparing the extracted features to a stored
database of faces, the program will attempt to recognize the identity
of the person in the image or video.

As you progress through this project, you'll delve into algorithms that make
this magic happen. You'll be working with concepts like:

● Cascade Classifiers: These are pre-trained models that can efficiently


detect faces in an image.
● Machine Learning: You might explore training your own model to
recognize faces based on a dataset of images.

This project is a gateway to the fascinating world of computer vision and its
applications. Are you ready to take on this challenge and build your own
face recognition system?
4
PROBLEM STATEMENT

In the era of digital security, there is a growing need for robust and efficient
biometric authentication systems. Traditional methods like passwords and
PINs are vulnerable to security breaches and do not provide the level of
assurance required for sensitive applications. Face recognition technology
offers a non-intrusive and user-friendly solution but comes with its own set
of challenges, such as varying lighting conditions, different facial
expressions, and obstructions.

Objective: To design and implement a real-time face recognition system


using C++ that can accurately identify individuals from a database of
known faces. The system should be capable of handling real-world variables
such as changes in lighting, facial expressions, and partial occlusions.

Requirements:

● The system must use a live video feed from a webcam to detect and
recognize faces in real-time.
● Implement an efficient algorithm for face detection that can quickly
locate faces within the video feed.
● Utilize a robust face recognition algorithm that can handle variations
in facial expression, lighting, and minor obstructions.
● The system should have a high accuracy rate for face recognition, with
minimal false positives and negatives.
● Develop a user-friendly interface for the system that allows for easy
enrollment of new faces into the database.
● Ensure the system operates efficiently, with a quick response time
that does not hinder the user experience.
● Incorporate security measures to prevent unauthorized access and

5
tampering with the face database.

Challenges:

● Optimizing the face detection algorithm to work efficiently in


different lighting conditions.
● Ensuring the face recognition algorithm is resilient against various
facial expressions and aging effects.
● Balancing the trade-off between recognition accuracy and system
performance.

Expected Outcome: A fully functional C++ program that demonstrates a


high level of accuracy in recognizing registered faces under various
conditions, contributing to the advancement of secure authentication
systems.

This problem statement sets the stage for developing a sophisticated face
recognition system that could be used in a variety of applications, from
security systems to user authentication protocols. Good luck with your
project!

OBJECTIVE

To engineer a cutting-edge face recognition system using C++ that serves as


a cornerstone for secure and intelligent identity verification. The system
aims to provide a seamless and accurate authentication process by
leveraging advanced algorithms and real-time processing. It will set a new
benchmark in biometric technology with its ability to adapt to diverse
environments and user conditions, ensuring a high degree of reliability and
user satisfaction.

This objective encapsulates the ambition to create a system that is not only
6
technologically advanced but also user-centric and adaptable to various
real-world scenarios. It’s designed to push the boundaries of what’s
possible with face recognition technology.

SCOPE OF THE PROJECT

The scope of a face recognition system in C++ is quite fascinating, as it


encompasses a wide range of applications and technological advancements.
Here’s an overview

1. Security Enhancement: The system can be integrated into various


security frameworks, providing a layer of biometric authentication
that is more secure than traditional methods.
2. User Experience: With real-time processing, the system offers a
frictionless user experience, eliminating the need for passwords or
physical tokens.

7
3. Accessibility: It opens up new possibilities for accessibility, allowing
individuals with physical disabilities to access services and devices
more easily.
4. Smart Home Integration: The system can be a key component in
smart home technology, enabling personalized settings and security
based on the recognized individual.
5. Retail and Marketing: In the retail sector, face recognition can offer
personalized shopping experiences and targeted advertising.
6. Healthcare: In healthcare, it can ensure patient privacy and security
by accurately identifying individuals for access to medical records and
facilities.
7. Law Enforcement: It can aid law enforcement by quickly identifying
individuals in crowds or at crime scenes.
8. Banking and Finance: The banking sector can use it to enhance the
security of transactions and customer interactions.
9. Research and Development: The system’s development will
contribute to the field of computer vision and machine learning,
pushing forward the boundaries of what’s achievable.
10. Cross-Platform Compatibility: Designed in C++, the system can
be made compatible with various operating systems and hardware,
increasing its applicability.

The scope of this project is not only technologically intriguing but also
socially impactful, as it can revolutionize the way we interact with our
devices and each other. It’s a step towards a more secure and personalized
future.

EXISTING SYSTEM

8
The existing systems for face recognition in C++ are quite diverse and have
evolved significantly over time. Here’s an overview of some of the current
systems and technologies:

OpenCV (Open Source Computer Vision Library):

● Algorithms: Includes Eigenfaces, Fisherfaces, and Local Binary


Patterns Histograms1.
● Features: Provides a comprehensive suite of tools and functions for
real-time face detection and recognition.
● Usage: Widely used in academic and commercial projects for its
robustness and versatility.

DeepFace by Facebook:

● Architecture: A 9-layer deep neural network with more than 120


million parameters2.
● Dataset: Trained on a dataset with 4 million facial images.
● Accuracy: Achieves a prediction accuracy of 97.35%.

FaceNet by Google:

● Architecture: A 22-layer deep convolutional neural network with L2


normalization2.
● Innovation: Introduces the triplet loss function.

9
● Accuracy: Scores 99.25% on the LFW dataset and 95.12% on the YFD
dataset.

LUNA SDK by VisionLabs:

● Capabilities: Offers APIs and tools for building end-to-end facial


recognition systems3.
● Performance: Optimized C++ libraries for high-performance facial
analysis tasks.

Real-time Facial Recognition Projects:

● Integration: Can be integrated into robotic projects using OpenCV4.


● Scope: Enables robots to recognize and interact with humans based
on facial features.

These systems represent the cutting-edge of face recognition technology,


leveraging deep learning and computer vision to provide accurate and
efficient solutions. They are used in a variety of applications, from security
to personalized user experiences.

PROPOSED SYSTEM

The proposed system for a face recognition system using C++ aims to
incorporate the latest advancements in technology to enhance accuracy,
speed, and adaptability. Here’s an outline of the proposed system:

Proposed System for C++ Face Recognition:

1. 3D Mapping Integration: Incorporating 3D mapping to capture facial


features with greater depth, improving accuracy and making the
system more resilient against attempts to deceive it1.
2. Deep Learning Algorithms: Utilizing deep learning algorithms to
10
increase performance and flexibility across various environments and
scenarios1.
3. Real-Time Processing: Ensuring the system can process and
recognize faces in real-time, even in dynamic and uncontrolled
settings.
4. Advanced Neural Networks: Implementing state-of-the-art neural
network architectures that mimic brain-like strategies for object and
face categorization2.
5. Enhanced Dataset Diversity: Expanding the training datasets to
include a wider variety of facial features, expressions, and
environmental conditions to improve system robustness.
6. Ethical Considerations: Addressing privacy and ethical concerns by
implementing strict data handling and processing protocols.
7. Cross-Platform Compatibility: Developing the system to be
compatible with various hardware and software platforms, ensuring
broader applicability.
8. User-Centric Design: Focusing on user experience by creating an
intuitive interface and seamless interaction processes.
9. Scalability: Designing the system to be scalable, allowing for easy
updates and integration of future technological advancements.
10. Research Contributions: Contributing to the body of knowledge
in computer vision and machine learning through innovative research
and development.

This proposed system represents a forward-thinking approach to face


recognition technology, aiming to set new standards in biometric
authentication and identity verification.

MODULES DESCRIPTION

11
A face recognition system can be divided into several modules, each
responsible for a specific part of the process. Here’s a description of the
typical modules you might find in a C++ face recognition system:

1. Image Acquisition Module:

● Function: Captures real-time images or video streams from cameras


or input devices.
● Technology: Utilizes OpenCV’s VideoCapture class to interface with
camera hardware.

2. Preprocessing Module:

● Function: Enhances image quality and prepares data for analysis.


● Components:
○ Grayscale Conversion: Converts images to grayscale to reduce
computational complexity.
○ Histogram Equalization: Improves contrast in images.

12
○ Noise Reduction: Applies filters to remove noise from images.

3. Face Detection Module:

● Function: Identifies and locates human faces within images.


● Components:
○ Haar Cascade Classifier: Uses pre-trained XML classifiers for
detecting facial features1.
○ Deep Learning Models: Optionally employs deep learning
models for more accurate detection.

4. Feature Extraction Module:

● Function: Extracts distinctive features from detected faces.


● Components:
○ Geometric Features: Measures distances and angles between
facial landmarks.
○ Appearance-Based Features: Uses techniques like Eigenfaces or
Fisherfaces for feature representation.

5. Database Module:

● Function: Stores and manages the facial feature data.


● Components:
○ Enrollment: Adds new face data to the system.
○ Querying: Retrieves face data for comparison.

6. Recognition and Matching Module:

● Function: Compares extracted features with database entries to


identify individuals.
● Components:
○ Similarity Metrics: Calculates the similarity between feature

13
sets.
○ Machine Learning Algorithms: Employs algorithms like
Support Vector Machines (SVM) for classification.

7. Post-Processing Module:

● Function: Handles the output of the recognition process.


● Components:
○ Decision Making: Determines if a match is found based on a
threshold.
○ Logging: Records recognition events and outcomes.

8. User Interface Module:

● Function: Provides an interface for users to interact with the system.


● Components:
○ Graphical User Interface (GUI): Allows users to enroll new
faces, view logs, and adjust settings.
○ Alerts and Notifications: Informs users about system status and
recognition events.

These modules work together to create a comprehensive face recognition


system that can be used in various applications, from security to user
authentication. The modular design also allows for flexibility and
scalability, as each component can be improved or replaced independently
as technology advances.UML DIAGRAMS

Creating UML diagrams for a face recognition system involves several types
of diagrams to represent different aspects of the system. Here are
descriptions of some key UML diagrams that would be part of such a
project:

1. Class Diagram:
14
● Purpose: Represents the static structure of the system by showing
system classes, their attributes, methods, and the relationships
between the classes.
● Components: Includes classes like Camera, ImageProcessor,
FaceDetector, FeatureExtractor, DatabaseManager, and
UserInterface.

2. Use Case Diagram:

● Purpose: Illustrates the interactions between the users (actors) and


the system to achieve a goal.
● Components: Actors such as Administrator, User, and use cases like
Enroll Face, Identify User, Verify Identity.

3. Sequence Diagram:

● Purpose: Describes how objects interact in a particular scenario of a


use case.
● Components: Objects like User, GUI, FaceRecognitionController, and
interactions such as Input Image, Detect Face, Recognize Face.

4. Activity Diagram:

● Purpose: Shows the dynamic aspects of the system by modeling the


workflow from one activity to another.
● Components: Activities like Capture Image, Process Image, Match
Face, and decisions that lead to different outcomes.

5. Component Diagram:

● Purpose: Depicts how components are wired together to form larger


components or software systems.
● Components: Components such as Face Detection Component,
15
Recognition Algorithm, Database, and interfaces like IDetection,
IRecognition.

6. Deployment Diagram:

● Purpose: Models the physical deployment of artifacts on nodes.


● Components: Nodes like Web Server, Application Server, Database
Server, and artifacts like FaceRecognitionApp, Database.

These diagrams would be created using UML tools and would provide a
comprehensive visual representation of the face recognition system’s
architecture, interactions, and processes. They are essential for planning,
designing, and documenting the system.

IMPLEMENTATION & CODING


// CPP program to detects face in a video

// Include required header files from OpenCV directory


#include "/usr/local/include/opencv2/objdetect.hpp"
#include "/usr/local/include/opencv2/highgui.hpp"
#include "/usr/local/include/opencv2/imgproc.hpp"
#include <iostream>

using namespace std;


using namespace cv;

// Function for Face Detection


void detectAndDraw( Mat& img, CascadeClassifier& cascade,
CascadeClassifier& nestedCascade, double scale );
string cascadeName, nestedCascadeName;

int main( int argc, const char** argv )


{
// VideoCapture class for playing video for which faces to be detected
16
VideoCapture capture;
Mat frame, image;

// PreDefined trained XML classifiers with facial features


CascadeClassifier cascade, nestedCascade;
double scale=1;

// Load classifiers from "opencv/data/haarcascades" directory


nestedCascade.load( "../../haarcascade_eye_tree_eyeglasses.xml" ) ;

// Change path before execution


cascade.load( "../../haarcascade_frontalcatface.xml" ) ;

// Start Video..1) 0 for WebCam 2) "Path to Video" for a Local Video


capture.open(0);
if( capture.isOpened() )
{
// Capture frames from video and detect faces
cout << "Face Detection Started...." << endl;
while(1)
{
capture >> frame;
if( frame.empty() )
break;
Mat frame1 = frame.clone();
detectAndDraw( frame1, cascade, nestedCascade, scale );
char c = (char)waitKey(10);

// Press q to exit from window


if( c == 27 || c == 'q' || c == 'Q' )
break;
}
}
else
cout<<"Could not Open Camera";
return 0;
}

17
void detectAndDraw( Mat& img, CascadeClassifier& cascade,
CascadeClassifier& nestedCascade,
double scale)
{
vector<Rect> faces, faces2;
Mat gray, smallImg;

cvtColor( img, gray, COLOR_BGR2GRAY ); // Convert to Gray Scale


double fx = 1 / scale;

// Resize the Grayscale Image


resize( gray, smallImg, Size(), fx, fx, INTER_LINEAR );
equalizeHist( smallImg, smallImg );

// Detect faces of different sizes using cascade classifier


cascade.detectMultiScale( smallImg, faces, 1.1,
2, 0|CASCADE_SCALE_IMAGE,
Size(30, 30) );

// Draw circles around the faces


for ( size_t i = 0; i < faces.size(); i++ )
{
Rect r = faces[i];
Mat smallImgROI;
vector<Rect> nestedObjects;
Point center;
Scalar color = Scalar(255, 0, 0); // Color for Drawing tool
int radius;

double aspect_ratio = (double)r.width/r.height;


if( 0.75 < aspect_ratio && aspect_ratio < 1.3 )
{
center.x = cvRound((r.x + r.width*0.5)*scale);
center.y = cvRound((r.y + r.height*0.5)*scale);
radius = cvRound((r.width + r.height)*0.25*scale);
circle( img, center, radius, color, 3, 8, 0 );
}
else

18
rectangle( img, cvPoint(cvRound(r.x*scale),
cvRound(r.y*scale)),
cvPoint(cvRound((r.x + r.width-1)*scale),
cvRound((r.y + r.height-1)*scale)), color, 3, 8,
0);
if( nestedCascade.empty() )
continue;
smallImgROI = smallImg( r );

// Detection of eyes in the input image


nestedCascade.detectMultiScale( smallImgROI, nestedObjects,
1.1, 2,
0|
CASCADE_SCALE_IMAGE, Size(30, 30) );

// Draw circles around eyes


for ( size_t j = 0; j < nestedObjects.size(); j++ )
{
Rect nr = nestedObjects[j];
center.x = cvRound((r.x + nr.x + nr.width*0.5)*scale);
center.y = cvRound((r.y + nr.y + nr.height*0.5)*scale);
radius = cvRound((nr.width + nr.height)*0.25*scale);
circle( img, center, radius, color, 3, 8, 0 );
}
}

// Show Processed Image with detected faces


imshow( "Face Detection", img );
}

CONCLUSION

In conclusion, the development of a face recognition system in C++


represents a significant stride in the field of computer vision and biometric
authentication. The system’s ability to provide real-time, accurate, and
secure identification has vast applications across various industries, from
19
security to personalized user experiences.

The integration of advanced algorithms and neural networks, along with


the power and efficiency of C++, has enabled the creation of a system that is
not only fast and reliable but also adaptable to different environments and
capable of learning from new data. This adaptability ensures that the
system remains effective even as faces change over time due to aging or
other factors.

Moreover, the system’s modular design allows for continuous


improvements and scalability, ensuring that it can evolve with technological
advancements and emerging needs. The ethical considerations and privacy
measures incorporated into the system reflect a commitment to responsible
innovation.

Overall, the C++ face recognition system stands as a testament to the


remarkable progress in computational capabilities and the potential for
technology to enhance security and convenience in our daily lives. As the
technology continues to mature, we can expect even more sophisticated and
seamless integration into various aspects of society.

20

You might also like