SlideShare a Scribd company logo
www.luxoft.com
Facial Recognition with C++
Pavel Zhdanov
www.luxoft.com 2
www.luxoft.com
About Me
www.luxoft.com 3
www.luxoft.com
Algorithm
● Face detection
● Train a face recognition model
● Recognize faces in images (video streams) with OpenCV.
www.luxoft.com 4
www.luxoft.com
std::string path = "photo.png";
cv::Mat img = cv::imread(path);
cv::imshow("Image", img);
cv::waitKey(0);
www.luxoft.com 5
www.luxoft.com
www.luxoft.com 6
www.luxoft.com
Haar Cascades
An Object Detection Algorithm used to identify faces
in an image or real time video
www.luxoft.com 7
www.luxoft.com
https://github.com/opencv/opencv/tree/master/data/haarcascades
These include models for:
• Face detection
• Eye detection
• Upper body
• Lower body detection
• License plate detection
• Etc.
www.luxoft.com 8
www.luxoft.com
How It Works
The Features
www.luxoft.com 9
www.luxoft.com
Features
• Edge
• Line
• Any structure in the image where there is a
sudden change of intensities
www.luxoft.com 10
www.luxoft.com
www.luxoft.com 11
www.luxoft.com
An edge is detected if the Haar value is closer to 1
www.luxoft.com 12
www.luxoft.com
Sample Haar Features
www.luxoft.com 13
www.luxoft.com
cv::Mat img = cv::imread("photo.png");
cv::CascadeClassifier faceCascade;
faceCascade.load("/haarcascade_frontalface_default.xml"));
std::vector<cv::Rect> faces;
faceCascade.detectMultiScale(img, faces, 1.1, 10);
for (int i = 0; i < faces.size(); ++i) {
cv::rectangle(img, faces[i].tl(), faces[i].br(), cv::Scalar(255, 0, 255), 3);
}
cv::imshow("Image", img);
cv::waitKey(0);
www.luxoft.com 14
www.luxoft.com
www.luxoft.com 15
www.luxoft.com
void detect_face_on_image_and_draw_circle(
cv::Mat& img,
cv::CascadeClassifier& faceCascade) {
std::vector<cv::Rect> faces;
faceCascade.detectMultiScale(img, faces, 1.1, 10);
for (int i = 0; i < faces.size(); ++i) {
cv::rectangle(img, faces[i].tl(), faces[i].br(), cv::Scalar(255, 0, 255), 3);
}
}
www.luxoft.com 16
www.luxoft.com
cv::VideoCapture cap(1);
cv::Mat img;
while (true) {
cap.read(img);
cv::imshow("Image", img);
cv::waitKey(1);
}
www.luxoft.com 17
www.luxoft.com
cv::VideoCapture cap(1);
cv::Mat img;
cv::CascadeClassifier faceCascade;
faceCascade.load(“haarcascade_frontalface_default.xml"));
while (true) {
cap.read(img);
detect_face_on_image_and_draw_circle(img, faceCascade);
cv::imshow("Image", img);
cv::waitKey(1);
}
www.luxoft.com
Thank you for your attention

More Related Content

PPTX
Computer Vision - Real Time Face Recognition using Open CV and Python
PDF
BSidesROC 2016 - Jaime Geiger - Android Application Function Hooking With Xposed
PPTX
ppt 20BET1024.pptx
PPTX
cvpresentation-190812154654 (1).pptx
PPTX
Final year ppt
PPTX
Face detection and recognition
PDF
IRJET- Survey on Face Recognition using Biometrics
PDF
Facial emotion recognition
Computer Vision - Real Time Face Recognition using Open CV and Python
BSidesROC 2016 - Jaime Geiger - Android Application Function Hooking With Xposed
ppt 20BET1024.pptx
cvpresentation-190812154654 (1).pptx
Final year ppt
Face detection and recognition
IRJET- Survey on Face Recognition using Biometrics
Facial emotion recognition

Similar to Face recognition with c++ (20)

PPTX
Face recognition
PPTX
Face Recognition using C#
PDF
Solr and Machine Vision - Scott Cote, Lucidworks & Trevor Grant, IBM
PPTX
Face Recognition: A Comprehensive Overview
PPTX
criminal face identification system.pptx
PPTX
ppt 20BET1024.pptx
PDF
What goes on during haar cascade face detection
ODP
Machine learning group - Practical examples
PDF
Paper of Final Year Project.pdf
PDF
K044065257
PPTX
Face detection and recognition report with pi in single poster
PDF
IRJET- Automated Criminal Identification System using Face Detection and Reco...
PDF
IRJET- Class Attendance using Face Detection and Recognition with OPENCV
PPTX
Face and Eye Detection Varying Scenarios With Haar Classifier_2015
PDF
IRJET- Face Detection and Recognition using OpenCV
PDF
IRJET- Facial Expression Recognition
PDF
IRJET- Face Recognition using Deep Learning
PDF
IRJET- Face Detection and Tracking Algorithm using Open CV with Raspberry Pi
PDF
FACIAL EMOTION RECOGNITION
PPTX
face detection
Face recognition
Face Recognition using C#
Solr and Machine Vision - Scott Cote, Lucidworks & Trevor Grant, IBM
Face Recognition: A Comprehensive Overview
criminal face identification system.pptx
ppt 20BET1024.pptx
What goes on during haar cascade face detection
Machine learning group - Practical examples
Paper of Final Year Project.pdf
K044065257
Face detection and recognition report with pi in single poster
IRJET- Automated Criminal Identification System using Face Detection and Reco...
IRJET- Class Attendance using Face Detection and Recognition with OPENCV
Face and Eye Detection Varying Scenarios With Haar Classifier_2015
IRJET- Face Detection and Recognition using OpenCV
IRJET- Facial Expression Recognition
IRJET- Face Recognition using Deep Learning
IRJET- Face Detection and Tracking Algorithm using Open CV with Raspberry Pi
FACIAL EMOTION RECOGNITION
face detection
Ad

More from LogeekNightUkraine (20)

PPTX
C++20 features
PPTX
Autonomous driving on your developer pc. technologies, approaches, future
PDF
Orkhan Gasimov "High Performance System Design"
PPTX
Vitalii Korzh "Managed Workflows or How to Master Data"
PDF
Yevhen Tatarynov "From POC to High-Performance .NET applications"
PDF
Oleksii Kuchuk "Reading gauge values with open cv imgproc"
PDF
Oleksandr Kutsan "Using katai struct to describe the process of working with ...
PDF
Pavlo Zhdanov "Mastering solid and base principles for software design"
PDF
Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"
PDF
Iurii Antykhovych "Java and performance tools and toys"
PDF
Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...
PPTX
Aleksandr Kutsan "Managing Dependencies in C++"
PDF
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
PDF
Alexandr Golyak, Nikolay Chertkov "Automotive Testing vs Test Automatio"
PPTX
Michal Kordas "Docker: Good, Bad or Both"
PPTX
Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"
PPTX
Shestakov Illia "The Sandbox Theory"
PPTX
Dmytro Kochergin “Autotest with CYPRESS”
PPTX
Ivan Dryzhyruk “Ducks Don’t Like Bugs”
PDF
Nhu Viet Nguyen "Why C++ is Becoming a Necessity for QA Automation"
C++20 features
Autonomous driving on your developer pc. technologies, approaches, future
Orkhan Gasimov "High Performance System Design"
Vitalii Korzh "Managed Workflows or How to Master Data"
Yevhen Tatarynov "From POC to High-Performance .NET applications"
Oleksii Kuchuk "Reading gauge values with open cv imgproc"
Oleksandr Kutsan "Using katai struct to describe the process of working with ...
Pavlo Zhdanov "Mastering solid and base principles for software design"
Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"
Iurii Antykhovych "Java and performance tools and toys"
Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...
Aleksandr Kutsan "Managing Dependencies in C++"
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
Alexandr Golyak, Nikolay Chertkov "Automotive Testing vs Test Automatio"
Michal Kordas "Docker: Good, Bad or Both"
Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"
Shestakov Illia "The Sandbox Theory"
Dmytro Kochergin “Autotest with CYPRESS”
Ivan Dryzhyruk “Ducks Don’t Like Bugs”
Nhu Viet Nguyen "Why C++ is Becoming a Necessity for QA Automation"
Ad

Recently uploaded (20)

PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
Big Data Technologies - Introduction.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
Understanding_Digital_Forensics_Presentation.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Big Data Technologies - Introduction.pptx
Machine learning based COVID-19 study performance prediction
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Encapsulation theory and applications.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Empathic Computing: Creating Shared Understanding
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?

Face recognition with c++