SlideShare a Scribd company logo
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 05 Issue: 10 | Oct 2018 www.irjet.net p-ISSN: 2395-0072
© 2018, IRJET | Impact Factor value: 7.211 | ISO 9001:2008 Certified Journal | Page 474
Face Detection and Recognition Using OpenCV
Mrs. Madhuram.M1, B. Prithvi Kumar2, Lakshman Sridhar3, Nishanth Prem4, Venkatesh Prasad5
1Assistant Professor, Department of Computer Science, SRM Institute of Science and Technology, Ramapuram,
Chennai, India
2,3,4,5Department of Computer Science, SRM Institute of Science and Technology, Ramapuram, Chennai, India
---------------------------------------------------------------------***---------------------------------------------------------------------
Abstract - Face detection and recognition from an image ora
video is a popular topic in biometrics research. Face
recognition technology has widely attracted attention due to
its enormous application value and market potential, such as
real-time video surveillance system. It is widely acknowledged
that the face recognition has played an important role in
surveillance system as itdoesn’tneedtheobject’sco-operation.
We design a real-time face recognition system based on IP
camera and image set algorithm by way of OpenCV and
Python programming development. The systemincludesthree
parts: Detection module, training module and recognition
module.
Key Words: Face detection, Face Recognition, OpenCV.
1. INTRODUCTION
Face detection and recognition is technology which is
used to identify a person from a video or photo source. In the
1960s face recognition was introduced by Woodrow Wilson
Bledsoe. Bledsoe developed a device that could classify
photos of faces by hand usingwhat’sknownasaRANDtablet,
a device that people could usetoinputhorizontalandvertical
coordinates on a grid using a pen like stylus that emitted
electromagnetic pulses. Ever since then the recognition
system is being improved and optimized constantly, the
technology becomes gradually mature and is more and more
widely used in human daily life. It has been used increasingly
for forensics by law enforcement and military professionals.
In fact, facial recognition systemwasusedtohelpconfirmthe
identity of Osama bin Laden after he was killed in a U.S. raid.
The face recognition system is also beingincreasinglyusedin
the mobiles for device security. In this paper, we propose a
face detection and recognition system using python along
with OpenCV package. This system contains three modules
which are detection, training and recognition. Basically, the
detection module detects the face which gets into the field of
vision of the camera and saves the face in the form of an
image in JPG format. Then the training modules trains the
system using Haar cascade algorithmwhichwasproposedby
Paul Viola and Michael Jones in their paper. This method
consists of four steps-
1. Haar Feature Selection-
First step is to collect the Haar Features. A Haar feature
considers adjacent rectangular regions at a specific location
in a detection window, sums up the pixel intensities in each
region and calculates the difference between these sums.
2. Creating Integral Images-
Integral Imagesare usedtomakethisprocessfast.Mostof
the calculated features are irrelevant.
3. Adaboost Training-
A concept called Adaboost which both selects the best
features and trains the classifiers is used. This algorithm
constructs a strong classifier using a linear combination of
weighted simple weak classifiers.
4. Cascading Classifiers-
The cascade classifier consists of a number of stages,
where each stage is a group of weak learners. These weak
learners are simple classifiers called decision stumps. Each
stage is trained using a method called boosting. Boosting
provides the ability to train a highly accurate classifier by
taking the weighted average of decisions made by the weak
learners.
Finally, in the recognition module the principal
components of the face from the new video are extracted.
Then those features get compared with the list of elements
stored during training and the ones with the best match is
found and name of the person recognized is displayed. This
monitoring system fulfills the basic needs of face detection
and recognition system,alsotakesthecostintoconsideration
to ensure the pervasive mode as economical as possible.
Furthermore, it can also be combined with real-timeanalysis
algorithms.
2. EXISTING SYSTEMS
A. Linear Discriminate Analysis
LDA is a method to find a linear combination of features
which characterize or separate two or more classes of
objects or events. Linear classifier can be obtained from the
resultant. Large number of pixels are used to represent face
in computerized face recognition. Before classification
Linear discriminant analysis is used to reduce features and
makes it more manageable. New dimensions are a linear
combination of pixel values which forms a template.
B. Principal Component Analysis
PCA involves a mathematical procedure that transforms a
number of possibly correlated variables into a smaller
number of uncorrelated variablesPleasepurchasePDFSplit-
Merge on www.verypdf.com to remove this watermark. 5
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 05 Issue: 10 | Oct 2018 www.irjet.net p-ISSN: 2395-0072
© 2018, IRJET | Impact Factor value: 7.211 | ISO 9001:2008 Certified Journal | Page 475
called principal components. The variability in the data is
accounted by the first principal components and the
succeeding components accounts for further variability. For
exploratory data analysis and for making predictive models
PCA is the most used tool. The calculation of the eigen value
decomposition of a data covariance matrix or singular value
decomposition of a data matrix is done with the help of PCA.
Eigenvector-based multivariate analysis is made easy with
the help of PCA. The variance present in the data is best
explained by revealing the internal structure of the data
which is considered to be one of the important operations.If
a multivariate dataset is visualized as a set of coordinates in
a high-dimensional data space (one axis per variable, a
lower-dimensional picture is supplied by PCA,a "shadow" of
this object is visible when viewed from its (in some sense)
most informative viewpoint.
C. Hidden Markov Model
A hidden Markov model (HMM) is a statistical model thatcan
be used to describe the evolution of observable events that
depend on internal factors, which are not directly
observable. The observed event is called as a `symbol' and
the factor underlying the observation is a `state'.. Hidden
Markov models are especiallyknownfortheirapplicationsin
temporal pattern recognition such as speech, handwriting,
gesture recognition, part-of-speech tagging, partial
discharges and bioinformatics.
3. PROPOSED SYSTEM AND TECHNIQUE
The quality of image depends on plethora of factors that
influence the system’s accuracy. It is important to apply
various pre-processing techniques to standardize the
images that you supply to a face recognition system. Face
recognition algorithm usually find it difficult to recognize a
face under extreme light sensitive conditions. If the system
was trained to recognize a person when they are in a dark
room, then it is highly possible that it won’t recognize them
in a bright room. This problem is referred to as "lumination
dependent". There are many other issues, such as the face
should also be in a very consistent position within the
images like the eyes being in the same pixel coordinates,
consistent size, rotation angle, hair and makeup, emotion
like smiling, angry, etc. Hence it is important to use a good
image preprocessing filter. For simplicity, the face
recognition system presented in this paper is Eigenfaces
using grayscale images. This paper showsusthatitiseasyto
convert color images to grayscale (also called 'grayscale')
and then to apply Histogram Equalization. It is a very simple
method of automatically standardizing the brightness and
contrast of your facial images. For better results, applymore
processing stages such as edge enhancement, contour
detection, motion detection, etc. OpenCVusesa facedetector
algorithm called a Haar Cascade classifier. An image, can
come from a file or from live video, the face detector
examines each image location and classifies it as "Face" or
"Not Face." Classification assumes a fixed scale for the face.
Faces in an image can be smaller or larger, the classifier runs
over the image several times, to search for faces across a
range of images. The classification is fast, even when it's
applied at several scales.Thecodefortherecognitionsystem
is given below.
4. SAMPLE CODE
A. Training Set
def assure_path_exists(path):
dir = os.path.dirname(path)
if not os.path.exists(dir):
os.makedirs(dir)
recognizer = cv2.face.LBPHFaceRecognizer_create()
Detector=cv2.CascadeClassifier("haarcascade_frontalface_de
fault.xml");
def getImagesAndLabels(path):
imagePaths = [os.path.join(path,f) for f in os.listdir(path)]
faceSamples=[]
ids = []
for imagePath in imagePaths:
PIL_img = Image.open(imagePath).convert('L')
img_numpy = np.array(PIL_img,'uint8')
id = int(os.path.split(imagePath)[-1].split(".")[1])
faces = detector.detectMultiScale(img_numpy)
for (x,y,w,h) in faces:
faceSamples.append(img_numpy[y:y+h,x:x+w])
ids.append(id)
return faceSamples,ids
faces,ids = getImagesAndLabels('dataset')
recognizer.train(faces, np.array(ids))
assure_path_exists('trainer/')
recognizer.save('trainer/trainer.yml')
B. Face Datasets
def assure_path_exists(path):
dir = os.path.dirname(path)
if not os.path.exists(dir):
os.makedirs(dir)
vid_cam = cv2.VideoCapture(0)
face_detector =
cv2.CascadeClassifier('haarcascade_frontalface_default.xm
l')
face_id = 1
count = 0
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 05 Issue: 10 | Oct 2018 www.irjet.net p-ISSN: 2395-0072
© 2018, IRJET | Impact Factor value: 7.211 | ISO 9001:2008 Certified Journal | Page 476
assure_path_exists("dataset/")
while(True):
_, image_frame = vid_cam.read()
gray = cv2.cvtColor(image_frame, cv2.COLOR_BGR2GRAY)
faces = face_detector.detectMultiScale(gray, 1.3, 5)
for (x,y,w,h) in faces:
cv2.rectangle(image_frame, (x,y), (x+w,y+h), (255,0,0), 2)
count += 1
cv2.imwrite("dataset/User." + str(face_id) + str(count) +
".jpg", gray[y:y+h,x:x+w])
cv2.imshow('frame', image_frame)
if cv2.waitKey(100) & 0xFF == ord('q'):
break
elif count>100:
break
vid_cam.release()
cv2.destroyAllWindows()
C. Face Detection
def assure_path_exists(path):
dir = os.path.dirname(path)
if not os.path.exists(dir):
os.makedirs(dir)
recognizer = cv2.face.LBPHFaceRecognizer_create()
assure_path_exists("trainer/")
recognizer.read('trainer/trainer.yml')
cascadePath = "haarcascade_frontalface_default.xml"
faceCascade = cv2.CascadeClassifier(cascadePath);
font = cv2.FONT_HERSHEY_SIMPLEX
cam = cv2.VideoCapture(0)
while True:
ret, im =cam.read()
gray = cv2.cvtColor(im,cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(gray, 1.2,5)
for(x,y,w,h) in faces:
cv2.rectangle(im, (x-20,y-20), (x+w+20,y+h+20),
(0,255,0), 4)
Id, confidence = recognizer.predict(gray[y:y+h,x:x+w])
if(Id == 1):
Id = "ARJUN {0:.2f}%".format(round(100 - confidence, 2))
cv2.rectangle(im, (x-22,y-90), (x+w+22, y-22), (0,255,0), -
1)
cv2.putText(im, str(Id), (x,y-40), font, 1, (255,255,255), 3)
cv2.imshow('im',im)
if cv2.waitKey(10) & 0xFF == ord('q'):
break
cam.release()
cv2.destroyAllWindows()
5. SYSTEM ARCHITECTURE
6. CONCLUSIONS
In this paper we have developed a system for face detection
and recognition using opencv. It is used to detect and
recognize human faces. The images of the persons are the
datasets which are defined and trained before recognizing.
Haar cascade algorithm is used for detection.
For better face recognition and detection small features can
be improved. In the coming future, as technology advances,
more advance features will be added to the system.
REFERENCES
[1] https://www.youtube.com/watch?list=PLQVvvaa0QuDf
KTOs3Keq_kaG2P55YRn5v&v=OGxgnH8y2NM
[2] https://opencv.org/
[3] https://docs.opencv.org/3.4/d7/d8b/tutorial_py_face_d
etection.html
[4] https://pythonprogramming.net/haar-cascade-object-
detection-python-opencv-tutorial/
[5] .Open Source Computer Vision Library Reference
Manual-intel [Media]
[6] Tej Pal Singh, “Face Recognition by using Feed Forward
Back Propagation Neural Network”, International
Journal of Innovative Research in Technology &Science,
vol.1, no.1
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 05 Issue: 10 | Oct 2018 www.irjet.net p-ISSN: 2395-0072
© 2018, IRJET | Impact Factor value: 7.211 | ISO 9001:2008 Certified Journal | Page 477
[7] N.Revathy, T.Guhan, “Face recognition system using
back propagation artificial neural networks”,
International Journal of Advanced Engineering
Technology, vol.3, no. 1, 2012.
[8] M.A.Turk and A.P. Pentaland, “Face Recognition Using
Eigenfaces”, IEEE conf. on Computer Vision and Pattern
Recognition, pp. 586-591, 1991

More Related Content

What's hot (18)

PDF
IRJET- Advance Driver Assistance System using Artificial Intelligence
IRJET Journal
 
DOCX
A deep learning facial expression recognition based scoring system for restau...
CloudTechnologies
 
PDF
An optimal face recoginition tool
eSAT Publishing House
 
PDF
Facial Expression Recognition
Rupinder Saini
 
PDF
IRJET- Face Recognition of Criminals for Security using Principal Component A...
IRJET Journal
 
PDF
Facial expression recongnition Techniques, Database and Classifiers
Rupinder Saini
 
PDF
IRJET- Spot Me - A Smart Attendance System based on Face Recognition
IRJET Journal
 
PDF
Artificial Intelligence based Pattern Recognition
Dr. Amarjeet Singh
 
PDF
An interactive image segmentation using multiple user input’s
eSAT Publishing House
 
PDF
M phil-computer-science-biometric-system-projects
Vijay Karan
 
PPTX
Fingerprints recognition
Gurjant Singh Sandhu
 
PDF
IRJET- An Overview on Automated Emotion Recognition System
IRJET Journal
 
PDF
Facial expression recognition
ElyesMiri
 
PDF
Automatic Emotion Recognition Using Facial Expression: A Review
IRJET Journal
 
PPTX
Facial emotion detection on babies' emotional face using Deep Learning.
Takrim Ul Islam Laskar
 
PDF
Photograph Database management report
Amrit Ranjan
 
PDF
IRJET- Smart Classroom Attendance System: Survey
IRJET Journal
 
PDF
Smart Doorbell System Based on Face Recognition
IRJET Journal
 
IRJET- Advance Driver Assistance System using Artificial Intelligence
IRJET Journal
 
A deep learning facial expression recognition based scoring system for restau...
CloudTechnologies
 
An optimal face recoginition tool
eSAT Publishing House
 
Facial Expression Recognition
Rupinder Saini
 
IRJET- Face Recognition of Criminals for Security using Principal Component A...
IRJET Journal
 
Facial expression recongnition Techniques, Database and Classifiers
Rupinder Saini
 
IRJET- Spot Me - A Smart Attendance System based on Face Recognition
IRJET Journal
 
Artificial Intelligence based Pattern Recognition
Dr. Amarjeet Singh
 
An interactive image segmentation using multiple user input’s
eSAT Publishing House
 
M phil-computer-science-biometric-system-projects
Vijay Karan
 
Fingerprints recognition
Gurjant Singh Sandhu
 
IRJET- An Overview on Automated Emotion Recognition System
IRJET Journal
 
Facial expression recognition
ElyesMiri
 
Automatic Emotion Recognition Using Facial Expression: A Review
IRJET Journal
 
Facial emotion detection on babies' emotional face using Deep Learning.
Takrim Ul Islam Laskar
 
Photograph Database management report
Amrit Ranjan
 
IRJET- Smart Classroom Attendance System: Survey
IRJET Journal
 
Smart Doorbell System Based on Face Recognition
IRJET Journal
 

Similar to IRJET- Face Detection and Recognition using OpenCV (20)

PDF
IRJET- Student Attendance System by Face Detection
IRJET Journal
 
PDF
IRJET - Design and Development of Android Application for Face Detection and ...
IRJET Journal
 
PDF
Paper of Final Year Project.pdf
MuhammadAsfandyarJan1
 
PDF
K044065257
IJERA Editor
 
PDF
Development of Real Time Face Recognition System using OpenCV
IRJET Journal
 
PDF
IRJET- Computerized Attendance System using Face Recognition
IRJET Journal
 
PDF
Ck36515520
IJERA Editor
 
PPTX
Real time face detection and recognition
ssuser471dfb
 
PDF
Real Time Implementation Of Face Recognition System
IJERA Editor
 
PDF
IRJET- Automated Criminal Identification System using Face Detection and Reco...
IRJET Journal
 
PDF
IRJET- Efficient Face Detection from Video Sequences using KNN and PCA
IRJET Journal
 
PDF
Face Recognition using PCA and Eigen Face Approach
IRJET Journal
 
PDF
IRJET-Comparision of PCA and LDA Techniques for Face Recognition Feature Base...
IRJET Journal
 
DOCX
Face recogntion using PCA algorithm
Ashwini Awatare
 
PDF
Face Recognition Based on Image Processing in an Advanced Robotic System
IRJET Journal
 
PDF
IRJET- Survey on Face Recognition using Biometrics
IRJET Journal
 
PPTX
Face Recognition System
StudentRocks
 
PDF
Face Recognition System and its Applications
IRJET Journal
 
PDF
IRJET - Face Detection and Recognition System
IRJET Journal
 
PDF
Face and facial expressions recognition for blind people
IRJET Journal
 
IRJET- Student Attendance System by Face Detection
IRJET Journal
 
IRJET - Design and Development of Android Application for Face Detection and ...
IRJET Journal
 
Paper of Final Year Project.pdf
MuhammadAsfandyarJan1
 
K044065257
IJERA Editor
 
Development of Real Time Face Recognition System using OpenCV
IRJET Journal
 
IRJET- Computerized Attendance System using Face Recognition
IRJET Journal
 
Ck36515520
IJERA Editor
 
Real time face detection and recognition
ssuser471dfb
 
Real Time Implementation Of Face Recognition System
IJERA Editor
 
IRJET- Automated Criminal Identification System using Face Detection and Reco...
IRJET Journal
 
IRJET- Efficient Face Detection from Video Sequences using KNN and PCA
IRJET Journal
 
Face Recognition using PCA and Eigen Face Approach
IRJET Journal
 
IRJET-Comparision of PCA and LDA Techniques for Face Recognition Feature Base...
IRJET Journal
 
Face recogntion using PCA algorithm
Ashwini Awatare
 
Face Recognition Based on Image Processing in an Advanced Robotic System
IRJET Journal
 
IRJET- Survey on Face Recognition using Biometrics
IRJET Journal
 
Face Recognition System
StudentRocks
 
Face Recognition System and its Applications
IRJET Journal
 
IRJET - Face Detection and Recognition System
IRJET Journal
 
Face and facial expressions recognition for blind people
IRJET Journal
 
Ad

More from IRJET Journal (20)

PDF
Enhanced heart disease prediction using SKNDGR ensemble Machine Learning Model
IRJET Journal
 
PDF
Utilizing Biomedical Waste for Sustainable Brick Manufacturing: A Novel Appro...
IRJET Journal
 
PDF
Kiona – A Smart Society Automation Project
IRJET Journal
 
PDF
DESIGN AND DEVELOPMENT OF BATTERY THERMAL MANAGEMENT SYSTEM USING PHASE CHANG...
IRJET Journal
 
PDF
Invest in Innovation: Empowering Ideas through Blockchain Based Crowdfunding
IRJET Journal
 
PDF
SPACE WATCH YOUR REAL-TIME SPACE INFORMATION HUB
IRJET Journal
 
PDF
A Review on Influence of Fluid Viscous Damper on The Behaviour of Multi-store...
IRJET Journal
 
PDF
Wireless Arduino Control via Mobile: Eliminating the Need for a Dedicated Wir...
IRJET Journal
 
PDF
Explainable AI(XAI) using LIME and Disease Detection in Mango Leaf by Transfe...
IRJET Journal
 
PDF
BRAIN TUMOUR DETECTION AND CLASSIFICATION
IRJET Journal
 
PDF
The Project Manager as an ambassador of the contract. The case of NEC4 ECC co...
IRJET Journal
 
PDF
"Enhanced Heat Transfer Performance in Shell and Tube Heat Exchangers: A CFD ...
IRJET Journal
 
PDF
Advancements in CFD Analysis of Shell and Tube Heat Exchangers with Nanofluid...
IRJET Journal
 
PDF
Breast Cancer Detection using Computer Vision
IRJET Journal
 
PDF
Auto-Charging E-Vehicle with its battery Management.
IRJET Journal
 
PDF
Analysis of high energy charge particle in the Heliosphere
IRJET Journal
 
PDF
A Novel System for Recommending Agricultural Crops Using Machine Learning App...
IRJET Journal
 
PDF
Auto-Charging E-Vehicle with its battery Management.
IRJET Journal
 
PDF
Analysis of high energy charge particle in the Heliosphere
IRJET Journal
 
PDF
Wireless Arduino Control via Mobile: Eliminating the Need for a Dedicated Wir...
IRJET Journal
 
Enhanced heart disease prediction using SKNDGR ensemble Machine Learning Model
IRJET Journal
 
Utilizing Biomedical Waste for Sustainable Brick Manufacturing: A Novel Appro...
IRJET Journal
 
Kiona – A Smart Society Automation Project
IRJET Journal
 
DESIGN AND DEVELOPMENT OF BATTERY THERMAL MANAGEMENT SYSTEM USING PHASE CHANG...
IRJET Journal
 
Invest in Innovation: Empowering Ideas through Blockchain Based Crowdfunding
IRJET Journal
 
SPACE WATCH YOUR REAL-TIME SPACE INFORMATION HUB
IRJET Journal
 
A Review on Influence of Fluid Viscous Damper on The Behaviour of Multi-store...
IRJET Journal
 
Wireless Arduino Control via Mobile: Eliminating the Need for a Dedicated Wir...
IRJET Journal
 
Explainable AI(XAI) using LIME and Disease Detection in Mango Leaf by Transfe...
IRJET Journal
 
BRAIN TUMOUR DETECTION AND CLASSIFICATION
IRJET Journal
 
The Project Manager as an ambassador of the contract. The case of NEC4 ECC co...
IRJET Journal
 
"Enhanced Heat Transfer Performance in Shell and Tube Heat Exchangers: A CFD ...
IRJET Journal
 
Advancements in CFD Analysis of Shell and Tube Heat Exchangers with Nanofluid...
IRJET Journal
 
Breast Cancer Detection using Computer Vision
IRJET Journal
 
Auto-Charging E-Vehicle with its battery Management.
IRJET Journal
 
Analysis of high energy charge particle in the Heliosphere
IRJET Journal
 
A Novel System for Recommending Agricultural Crops Using Machine Learning App...
IRJET Journal
 
Auto-Charging E-Vehicle with its battery Management.
IRJET Journal
 
Analysis of high energy charge particle in the Heliosphere
IRJET Journal
 
Wireless Arduino Control via Mobile: Eliminating the Need for a Dedicated Wir...
IRJET Journal
 
Ad

Recently uploaded (20)

PPTX
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
PDF
20ES1152 Programming for Problem Solving Lab Manual VRSEC.pdf
Ashutosh Satapathy
 
PPT
New_school_Engineering_presentation_011707.ppt
VinayKumar304579
 
PDF
REINFORCEMENT LEARNING IN DECISION MAKING SEMINAR REPORT
anushaashraf20
 
PPTX
What is Shot Peening | Shot Peening is a Surface Treatment Process
Vibra Finish
 
PPT
Testing and final inspection of a solar PV system
MuhammadSanni2
 
PDF
Electrical Machines and Their Protection.pdf
Nabajyoti Banik
 
PPTX
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
PPTX
MODULE 03 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
PDF
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
PPTX
MODULE 05 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
PDF
methodology-driven-mbse-murphy-july-hsv-huntsville6680038572db67488e78ff00003...
henriqueltorres1
 
PDF
aAn_Introduction_to_Arcadia_20150115.pdf
henriqueltorres1
 
PDF
mbse_An_Introduction_to_Arcadia_20150115.pdf
henriqueltorres1
 
PDF
Submit Your Papers-International Journal on Cybernetics & Informatics ( IJCI)
IJCI JOURNAL
 
PDF
MODULE-5 notes [BCG402-CG&V] PART-B.pdf
Alvas Institute of Engineering and technology, Moodabidri
 
PPT
Footbinding.pptmnmkjkjkknmnnjkkkkkkkkkkkkkk
mamadoundiaye42742
 
PDF
Data structures notes for unit 2 in computer science.pdf
sshubhamsingh265
 
PPTX
MODULE 04 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
PDF
SERVERLESS PERSONAL TO-DO LIST APPLICATION
anushaashraf20
 
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
20ES1152 Programming for Problem Solving Lab Manual VRSEC.pdf
Ashutosh Satapathy
 
New_school_Engineering_presentation_011707.ppt
VinayKumar304579
 
REINFORCEMENT LEARNING IN DECISION MAKING SEMINAR REPORT
anushaashraf20
 
What is Shot Peening | Shot Peening is a Surface Treatment Process
Vibra Finish
 
Testing and final inspection of a solar PV system
MuhammadSanni2
 
Electrical Machines and Their Protection.pdf
Nabajyoti Banik
 
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
MODULE 03 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
MODULE 05 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
methodology-driven-mbse-murphy-july-hsv-huntsville6680038572db67488e78ff00003...
henriqueltorres1
 
aAn_Introduction_to_Arcadia_20150115.pdf
henriqueltorres1
 
mbse_An_Introduction_to_Arcadia_20150115.pdf
henriqueltorres1
 
Submit Your Papers-International Journal on Cybernetics & Informatics ( IJCI)
IJCI JOURNAL
 
MODULE-5 notes [BCG402-CG&V] PART-B.pdf
Alvas Institute of Engineering and technology, Moodabidri
 
Footbinding.pptmnmkjkjkknmnnjkkkkkkkkkkkkkk
mamadoundiaye42742
 
Data structures notes for unit 2 in computer science.pdf
sshubhamsingh265
 
MODULE 04 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
SERVERLESS PERSONAL TO-DO LIST APPLICATION
anushaashraf20
 

IRJET- Face Detection and Recognition using OpenCV

  • 1. International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 05 Issue: 10 | Oct 2018 www.irjet.net p-ISSN: 2395-0072 © 2018, IRJET | Impact Factor value: 7.211 | ISO 9001:2008 Certified Journal | Page 474 Face Detection and Recognition Using OpenCV Mrs. Madhuram.M1, B. Prithvi Kumar2, Lakshman Sridhar3, Nishanth Prem4, Venkatesh Prasad5 1Assistant Professor, Department of Computer Science, SRM Institute of Science and Technology, Ramapuram, Chennai, India 2,3,4,5Department of Computer Science, SRM Institute of Science and Technology, Ramapuram, Chennai, India ---------------------------------------------------------------------***--------------------------------------------------------------------- Abstract - Face detection and recognition from an image ora video is a popular topic in biometrics research. Face recognition technology has widely attracted attention due to its enormous application value and market potential, such as real-time video surveillance system. It is widely acknowledged that the face recognition has played an important role in surveillance system as itdoesn’tneedtheobject’sco-operation. We design a real-time face recognition system based on IP camera and image set algorithm by way of OpenCV and Python programming development. The systemincludesthree parts: Detection module, training module and recognition module. Key Words: Face detection, Face Recognition, OpenCV. 1. INTRODUCTION Face detection and recognition is technology which is used to identify a person from a video or photo source. In the 1960s face recognition was introduced by Woodrow Wilson Bledsoe. Bledsoe developed a device that could classify photos of faces by hand usingwhat’sknownasaRANDtablet, a device that people could usetoinputhorizontalandvertical coordinates on a grid using a pen like stylus that emitted electromagnetic pulses. Ever since then the recognition system is being improved and optimized constantly, the technology becomes gradually mature and is more and more widely used in human daily life. It has been used increasingly for forensics by law enforcement and military professionals. In fact, facial recognition systemwasusedtohelpconfirmthe identity of Osama bin Laden after he was killed in a U.S. raid. The face recognition system is also beingincreasinglyusedin the mobiles for device security. In this paper, we propose a face detection and recognition system using python along with OpenCV package. This system contains three modules which are detection, training and recognition. Basically, the detection module detects the face which gets into the field of vision of the camera and saves the face in the form of an image in JPG format. Then the training modules trains the system using Haar cascade algorithmwhichwasproposedby Paul Viola and Michael Jones in their paper. This method consists of four steps- 1. Haar Feature Selection- First step is to collect the Haar Features. A Haar feature considers adjacent rectangular regions at a specific location in a detection window, sums up the pixel intensities in each region and calculates the difference between these sums. 2. Creating Integral Images- Integral Imagesare usedtomakethisprocessfast.Mostof the calculated features are irrelevant. 3. Adaboost Training- A concept called Adaboost which both selects the best features and trains the classifiers is used. This algorithm constructs a strong classifier using a linear combination of weighted simple weak classifiers. 4. Cascading Classifiers- The cascade classifier consists of a number of stages, where each stage is a group of weak learners. These weak learners are simple classifiers called decision stumps. Each stage is trained using a method called boosting. Boosting provides the ability to train a highly accurate classifier by taking the weighted average of decisions made by the weak learners. Finally, in the recognition module the principal components of the face from the new video are extracted. Then those features get compared with the list of elements stored during training and the ones with the best match is found and name of the person recognized is displayed. This monitoring system fulfills the basic needs of face detection and recognition system,alsotakesthecostintoconsideration to ensure the pervasive mode as economical as possible. Furthermore, it can also be combined with real-timeanalysis algorithms. 2. EXISTING SYSTEMS A. Linear Discriminate Analysis LDA is a method to find a linear combination of features which characterize or separate two or more classes of objects or events. Linear classifier can be obtained from the resultant. Large number of pixels are used to represent face in computerized face recognition. Before classification Linear discriminant analysis is used to reduce features and makes it more manageable. New dimensions are a linear combination of pixel values which forms a template. B. Principal Component Analysis PCA involves a mathematical procedure that transforms a number of possibly correlated variables into a smaller number of uncorrelated variablesPleasepurchasePDFSplit- Merge on www.verypdf.com to remove this watermark. 5
  • 2. International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 05 Issue: 10 | Oct 2018 www.irjet.net p-ISSN: 2395-0072 © 2018, IRJET | Impact Factor value: 7.211 | ISO 9001:2008 Certified Journal | Page 475 called principal components. The variability in the data is accounted by the first principal components and the succeeding components accounts for further variability. For exploratory data analysis and for making predictive models PCA is the most used tool. The calculation of the eigen value decomposition of a data covariance matrix or singular value decomposition of a data matrix is done with the help of PCA. Eigenvector-based multivariate analysis is made easy with the help of PCA. The variance present in the data is best explained by revealing the internal structure of the data which is considered to be one of the important operations.If a multivariate dataset is visualized as a set of coordinates in a high-dimensional data space (one axis per variable, a lower-dimensional picture is supplied by PCA,a "shadow" of this object is visible when viewed from its (in some sense) most informative viewpoint. C. Hidden Markov Model A hidden Markov model (HMM) is a statistical model thatcan be used to describe the evolution of observable events that depend on internal factors, which are not directly observable. The observed event is called as a `symbol' and the factor underlying the observation is a `state'.. Hidden Markov models are especiallyknownfortheirapplicationsin temporal pattern recognition such as speech, handwriting, gesture recognition, part-of-speech tagging, partial discharges and bioinformatics. 3. PROPOSED SYSTEM AND TECHNIQUE The quality of image depends on plethora of factors that influence the system’s accuracy. It is important to apply various pre-processing techniques to standardize the images that you supply to a face recognition system. Face recognition algorithm usually find it difficult to recognize a face under extreme light sensitive conditions. If the system was trained to recognize a person when they are in a dark room, then it is highly possible that it won’t recognize them in a bright room. This problem is referred to as "lumination dependent". There are many other issues, such as the face should also be in a very consistent position within the images like the eyes being in the same pixel coordinates, consistent size, rotation angle, hair and makeup, emotion like smiling, angry, etc. Hence it is important to use a good image preprocessing filter. For simplicity, the face recognition system presented in this paper is Eigenfaces using grayscale images. This paper showsusthatitiseasyto convert color images to grayscale (also called 'grayscale') and then to apply Histogram Equalization. It is a very simple method of automatically standardizing the brightness and contrast of your facial images. For better results, applymore processing stages such as edge enhancement, contour detection, motion detection, etc. OpenCVusesa facedetector algorithm called a Haar Cascade classifier. An image, can come from a file or from live video, the face detector examines each image location and classifies it as "Face" or "Not Face." Classification assumes a fixed scale for the face. Faces in an image can be smaller or larger, the classifier runs over the image several times, to search for faces across a range of images. The classification is fast, even when it's applied at several scales.Thecodefortherecognitionsystem is given below. 4. SAMPLE CODE A. Training Set def assure_path_exists(path): dir = os.path.dirname(path) if not os.path.exists(dir): os.makedirs(dir) recognizer = cv2.face.LBPHFaceRecognizer_create() Detector=cv2.CascadeClassifier("haarcascade_frontalface_de fault.xml"); def getImagesAndLabels(path): imagePaths = [os.path.join(path,f) for f in os.listdir(path)] faceSamples=[] ids = [] for imagePath in imagePaths: PIL_img = Image.open(imagePath).convert('L') img_numpy = np.array(PIL_img,'uint8') id = int(os.path.split(imagePath)[-1].split(".")[1]) faces = detector.detectMultiScale(img_numpy) for (x,y,w,h) in faces: faceSamples.append(img_numpy[y:y+h,x:x+w]) ids.append(id) return faceSamples,ids faces,ids = getImagesAndLabels('dataset') recognizer.train(faces, np.array(ids)) assure_path_exists('trainer/') recognizer.save('trainer/trainer.yml') B. Face Datasets def assure_path_exists(path): dir = os.path.dirname(path) if not os.path.exists(dir): os.makedirs(dir) vid_cam = cv2.VideoCapture(0) face_detector = cv2.CascadeClassifier('haarcascade_frontalface_default.xm l') face_id = 1 count = 0
  • 3. International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 05 Issue: 10 | Oct 2018 www.irjet.net p-ISSN: 2395-0072 © 2018, IRJET | Impact Factor value: 7.211 | ISO 9001:2008 Certified Journal | Page 476 assure_path_exists("dataset/") while(True): _, image_frame = vid_cam.read() gray = cv2.cvtColor(image_frame, cv2.COLOR_BGR2GRAY) faces = face_detector.detectMultiScale(gray, 1.3, 5) for (x,y,w,h) in faces: cv2.rectangle(image_frame, (x,y), (x+w,y+h), (255,0,0), 2) count += 1 cv2.imwrite("dataset/User." + str(face_id) + str(count) + ".jpg", gray[y:y+h,x:x+w]) cv2.imshow('frame', image_frame) if cv2.waitKey(100) & 0xFF == ord('q'): break elif count>100: break vid_cam.release() cv2.destroyAllWindows() C. Face Detection def assure_path_exists(path): dir = os.path.dirname(path) if not os.path.exists(dir): os.makedirs(dir) recognizer = cv2.face.LBPHFaceRecognizer_create() assure_path_exists("trainer/") recognizer.read('trainer/trainer.yml') cascadePath = "haarcascade_frontalface_default.xml" faceCascade = cv2.CascadeClassifier(cascadePath); font = cv2.FONT_HERSHEY_SIMPLEX cam = cv2.VideoCapture(0) while True: ret, im =cam.read() gray = cv2.cvtColor(im,cv2.COLOR_BGR2GRAY) faces = faceCascade.detectMultiScale(gray, 1.2,5) for(x,y,w,h) in faces: cv2.rectangle(im, (x-20,y-20), (x+w+20,y+h+20), (0,255,0), 4) Id, confidence = recognizer.predict(gray[y:y+h,x:x+w]) if(Id == 1): Id = "ARJUN {0:.2f}%".format(round(100 - confidence, 2)) cv2.rectangle(im, (x-22,y-90), (x+w+22, y-22), (0,255,0), - 1) cv2.putText(im, str(Id), (x,y-40), font, 1, (255,255,255), 3) cv2.imshow('im',im) if cv2.waitKey(10) & 0xFF == ord('q'): break cam.release() cv2.destroyAllWindows() 5. SYSTEM ARCHITECTURE 6. CONCLUSIONS In this paper we have developed a system for face detection and recognition using opencv. It is used to detect and recognize human faces. The images of the persons are the datasets which are defined and trained before recognizing. Haar cascade algorithm is used for detection. For better face recognition and detection small features can be improved. In the coming future, as technology advances, more advance features will be added to the system. REFERENCES [1] https://www.youtube.com/watch?list=PLQVvvaa0QuDf KTOs3Keq_kaG2P55YRn5v&v=OGxgnH8y2NM [2] https://opencv.org/ [3] https://docs.opencv.org/3.4/d7/d8b/tutorial_py_face_d etection.html [4] https://pythonprogramming.net/haar-cascade-object- detection-python-opencv-tutorial/ [5] .Open Source Computer Vision Library Reference Manual-intel [Media] [6] Tej Pal Singh, “Face Recognition by using Feed Forward Back Propagation Neural Network”, International Journal of Innovative Research in Technology &Science, vol.1, no.1
  • 4. International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 05 Issue: 10 | Oct 2018 www.irjet.net p-ISSN: 2395-0072 © 2018, IRJET | Impact Factor value: 7.211 | ISO 9001:2008 Certified Journal | Page 477 [7] N.Revathy, T.Guhan, “Face recognition system using back propagation artificial neural networks”, International Journal of Advanced Engineering Technology, vol.3, no. 1, 2012. [8] M.A.Turk and A.P. Pentaland, “Face Recognition Using Eigenfaces”, IEEE conf. on Computer Vision and Pattern Recognition, pp. 586-591, 1991