0% found this document useful (0 votes)
18 views12 pages

Batch 2 Project ML

Uploaded by

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

Batch 2 Project ML

Uploaded by

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

A PROJECT REPORT

ON

Real-Time Face Detection & Recognition using OpenCV

Submitted by

22RH1A6668 G.Sushmitha

22RH1A6669 G.Vaishnavi

22RH1A6670 G.Harshini

DEPARTMENT OF
ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING

MALLA REDDY ENGINEERING COLLEGE FOR WOMEN


Autonomous Institution, UGC, Govt. of India
Programmes Accredited by NBA(CSE,IT,ECE,EEE)
Accredited by NAAC with A+ Grade
Affiliated to JNTUH, Approved by AICTE, ISO 9001:2015 Certified Institute Maisammaguda
(V), Dhullapally (Post), (Via) Kompally, Medchal Malkajgiri Dist. T.S-500100

2024-2025
ABSTRACT

This project focuses on developing a real-time face detection and recognition system
using OpenCV, a popular computer vision library in Python. The system captures live
video from a webcam, detects faces in the frame, and recognizes them using a pre-
trained model. It combines techniques like Haar cascades or DNN models for detection
and LBPH, Eigenfaces, or deep learning methods for recognition. The implementation
is lightweight, efficient, and adaptable to various environments. This system has
potential applications in security, attendance systems, and personalized user
experiences. The document outlines the methodology, results, and scope for future
enhancements
INDEX

Title Page No.

Abstract i
Introduction 1

System requirement 2

Literature survey 3

System architecture 4

Implementation 5

Result 6

Conclusion 7

Future Scope 8

References 9
INTRODUCTION

Face detection and recognition are critical components of modern computer vision
systems. They enable machines to identify and verify individuals based on their facial
features. With advancements in machine learning and deep learning, real-time face
recognition has become more accurate and reliable. This project leverages OpenCV, a
robust computer vision library, to implement face detection and recognition in real time.
The system uses a webcam to capture video frames, identifies faces using efficient
algorithms, and matches them with a database of known faces. Applications range from
enhancing security to automating attendance and enabling personalize services.

1
SYSTEM REQUIREMENTS

Hardware Requirements :
1. Processor: Multi-core processor (Intel i5 or equivalent) for efficient real-time processing.
2. RAM: Minimum 8GB for smooth operation of face detection and recognition algorithms.
3. Webcam: HD webcam for capturing clear video frames.
4. Storage: At least 1GB of free disk space for saving datasets and model files.
5. Graphics Card(optional): NVIDIA GPU for faster processing when using deep learning models.

Software Requirements:
1. Operating System: Windows 10/11, Linux (Ubuntu), or macOS.
2. Programming Language: Python 3.7 or higher.
3. Libraries: OpenCV, NumPy, and dlib for face detection and recognition.
4. IDE/Tools: Jupyter Notebook or any Python-compatible IDE (e.g., PyCharm, VS Code).
5. Pre-trained Model: Haar cascades or custom-trained models for face recognition.

2
LITERATURE SURVEY

Face detection and recognition have been researched extensively in the field of computer
vision. Traditional methods like Haar cascades and HOG features provide robust
detection, while Eigenfaces and Fisherfaces have been widely used for recognition.
Recent advancements include convolutional neural networks (CNNs), which achieve
higher accuracy by learning complex facial patterns. OpenCV has simplified
implementation by providing pre-built functions for both detection and recognition.
Research also highlights the importance of real-time systems in applications like
surveillance and user authentication, where speed and accuracy are critical.

3
SYSTEM ARCHITECTURE

The system consists of two primary modules: face detection and face recognition. The
face detection module uses Haar cascades or a deep learning-based model to identify
faces in video frames. Once detected, the face is cropped and passed to the recognition
module, which compares it with stored data using algorithms like LBPH or deep neural
networks. The architecture integrates OpenCV for video processing, NumPy for data
handling, and a lightweight database for storing known faces. The output includes the
detected face with a label identifying the person or marking it as unknown.

4
IMPLEMENTATION

import cv2
import numpy as np

# Load pre-trained face detection model


face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml')

# Load recognizer and trained model


recognizer = cv2.face.LBPHFaceRecognizer_create()
recognizer.read('trained_model.yml') # Replace with your model file

# Start webcam
cap = cv2.VideoCapture(0)

while True:
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(gray, 1.3, 5)

for (x, y, w, h) in faces:


face = gray[y:y+h, x:x+w]
label, confidence = recognizer.predict(face)
label_text = f"ID: {label}, Conf: {confidence:.2f}"
cv2.rectangle(frame, (x, y), (x+w, y+h), (255, 0, 0), 2)
cv2.putText(frame, label_text, (x, y-10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (255, 255, 255), 2)

cv2.imshow('Face Recognition', frame)


if cv2.waitKey(1) & 0xFF == ord('q'):
break

cap.release()
cv2.destroyAllWindows()

5
RESULTS

6
CONCLUSION

This project demonstrates the implementation of a real-time face detection and recognition
system using OpenCV. By leveraging powerful algorithms like Haar cascades for detection and
LBPH for recognition, the system achieves high efficiency and accuracy. It proves to be a cost-
effective solution for various applications, including security systems, attendance automation,
and user authentication. The integration of OpenCV simplifies the development process,
making it accessible for developers. This project highlights the potential of computer vision in
solving real-world problems and serves as a foundation for future enhancements in face
recognition technology.

7
FUTURE SCOPE

The system can be extended with several improvements for enhanced performance and
functionality. Incorporating deep learning-based models, such as CNNs, can significantly
increase accuracy for challenging scenarios like occlusion or poor lighting. Adding multi-face
recognition capability would allow handling multiple individuals simultaneously. Cloud
integration for storing and managing large datasets can improve scalability. Implementing
additional security measures, such as spoof detection, can make the system more robust. These
enhancements would broaden the scope of applications and address the evolving needs of
industries relying on face recognition technologies.

8
REFERENCES

1. Bradski, G., & Kaehler, A. (2008). Learning OpenCV: Computer Vision with the OpenCV
Library. O'Reilly Media.

2. Viola, P., & Jones, M. (2001). Rapid object detection using a boosted cascade of simple
features. Proceedings of CVPR.

3. OpenCV Documentation. Retrieved from [https://docs.opencv.org](https://docs.opencv.org)

4. Turk, M., &Pentland, A. (1991). Eigenfaces for recognition. Journal of Cognitive


Neuroscience.

5. Dlib Library Documentation. Retrieved from [http://dlib.net](http://dlib.net)

6.Python Official Documentation. Retrieved from


[https://www.python.org/doc](https://www.python.org/doc)

You might also like