SlideShare a Scribd company logo
1 of 24
Face Detection
Using Viola-
Jones Algorithm
Agenda
Introduction
Face
Recognition
Face
Detection
Face
Detection
Viola-Jones Algorithm
Viola-Jones Algorithm
Viola-Jones outlines a box and
searches for a face within the box. It
is essentially searching for these
haar-like features, which will be
explained later. The box moves a
step to the right after going through
every tile in the picture. In this case,
we have used a large box size and
taken large steps for demonstration,
but in general, you can change the
box size and step size according to
your needs.
Haar-Like Features
With smaller steps, a number of
boxes detect face-like features
(Haar-like features) and the data of
all of those boxes put together,
helps the algorithm determine
where the face is.
Haar-Like Features
The features on right show a box
with a light side and a dark side,
which is how the machine
determines what the feature is.
Sometimes one side will be lighter
than the other, as in an edge of an
eyebrow. Sometimes the middle
portion may be shinier than the
surrounding boxes, which can be
interpreted as a nose.
Haar-Like Features
There are 3 types of Haar-like
features that Viola and Jones
identified in their research:
• Edge features
• Line-features
• Four-sided features
Haar-Like Features
These features help the machine
understand what the image is.
Imagine what the edge of a table
would look like on a b&w image.
One side will be lighter than the
other, creating that edge like b&w
feature as you can see in the
picture.
Haar-Like Features
In the two important features for
Face Detection, the horizontal and
the vertical features describe what
eyebrows and the nose,
respectively, look like to the
machine. Additionally, when the
images are inspected, each feature
has a value of its own. It’s quite
easy to calculate: Subtract White
area from the Black area.
Haar-Like Features
Imagine our haar-like feature was converted
into a grid. Each square represents a pixel.
For demonstration, we choose a 4 x 8 grid,
but in reality, there would be many more
pixels and thus a much larger grid for a
certain feature. The numbers in the boxes
represent the darkness of the features. The
higher it is, the darker the pixel. Thus, you
can see the numbers are higher on the right
side than on the left side. Now if you add up
the numbers on the two left-sided (white)
columns, and subtract it from the sum of the
right-sided columns, you will get the value of
the particular feature.
Haar-Like Features
So in this case, the value of our feature is →
(0.5 + 0.4 + 0.5 +0.6 + 0.4 + 0.7 + 0.5 + 0.4
+
0.4 + 0.5 + 0.6 + 0.8 + 0.5 + 0.7 + 0.6 + 0.6)
-
(0.1 + 0.1 + 0.2 + 0. 2+ 0.2 + 0.1 + 0.2 + 0.2
+
0.2 + 0.3 + 0.2 + 0.1 + 0.2 + 0.3 + 0.2 + 0.2)
B - W= 8.7 - 3
= 5.7
Integral Image
In reality, these calculations can be very
intensive since the number of pixels would
be much greater within a large feature.
The integral image plays its part in
allowing us to perform these intensive
calculations quickly so we can understand
whether a feature of a number of features
fit the criteria.
Integral Image
Now imagine the one highlighted in red is
our grid for a certain feature, and we are
trying to calculate the value of that feature.
Normally we would just add up the boxes,
but since that can be computationally
intensive, we will create an integral image.
Integral Image
To calculate the value of a single box in
the integral image, we take the sum of all
the boxes to its left.
Integral Image
The green box in the integral image is
calculated as the sum of the highlighted
area in the regular image. If we did this for
every box, we would have a sequence
going through the grid and it may look
something like the image below.
All we have to do is look at the 4 corners
of our feature, and add the purples,
subtract the greens.
→ 168–114 + 79–110 = 23
Why Integral Image?
Haar-like features are actually rectangular,
and the integral image process allows us
to find a feature within an image very
easily as we already know the sum value
of a particular square and to find the
difference between two rectangles in the
regular image, we just need to subtract
two squares in the integral image. So even
if you had a 1000 x 1000 pixels in your
grid, the integral image method makes the
calculations much less intensive and can
save a lot of time for any facial detection
model.
Flow For Face
Detection
Conditions For
Eyes & Upper
Body Detection
Summary
Thank You

More Related Content

Similar to GUI based Face detection using Viola-Jones algorithm in MATLAB.

Data Science - Part XVII - Deep Learning & Image Processing
Data Science - Part XVII - Deep Learning & Image ProcessingData Science - Part XVII - Deep Learning & Image Processing
Data Science - Part XVII - Deep Learning & Image ProcessingDerek Kane
 
Binary Features for Object Detection and Landmarking
Binary Features for Object Detection and LandmarkingBinary Features for Object Detection and Landmarking
Binary Features for Object Detection and LandmarkingComponica LLC
 
What goes on during haar cascade face detection
What goes on during haar cascade face detectionWhat goes on during haar cascade face detection
What goes on during haar cascade face detectionOnibiyo Joshua Toluse
 
Miscellneous functions
Miscellneous  functionsMiscellneous  functions
Miscellneous functionsTarun Gehlot
 
Avoid Overfitting with Regularization
Avoid Overfitting with RegularizationAvoid Overfitting with Regularization
Avoid Overfitting with RegularizationAhmed Gad
 
06 image features
06 image features06 image features
06 image featuresankit_ppt
 
07 dimensionality reduction
07 dimensionality reduction07 dimensionality reduction
07 dimensionality reductionMarco Quartulli
 
Convolutional neural network complete guide
Convolutional neural network complete guideConvolutional neural network complete guide
Convolutional neural network complete guideMLTUT
 
Rahat & juhith
Rahat & juhithRahat & juhith
Rahat & juhithRj Juhith
 
my math on calculus mathematics for college
my math on calculus mathematics for collegemy math on calculus mathematics for college
my math on calculus mathematics for collegecarltonjackson8
 
Alice 3
Alice 3Alice 3
Alice 3frcol
 
Facial Expression Recognition via Python
Facial Expression Recognition via PythonFacial Expression Recognition via Python
Facial Expression Recognition via PythonSaurav Gupta
 
Predicting Facial Expression using Neural Network
Predicting Facial Expression using Neural Network Predicting Facial Expression using Neural Network
Predicting Facial Expression using Neural Network Santanu Paul
 
Sorting-algorithmbhddcbjkmbgjkuygbjkkius.pdf
Sorting-algorithmbhddcbjkmbgjkuygbjkkius.pdfSorting-algorithmbhddcbjkmbgjkuygbjkkius.pdf
Sorting-algorithmbhddcbjkmbgjkuygbjkkius.pdfArjunSingh81957
 
Acm aleppo cpc training sixth session
Acm aleppo cpc training sixth sessionAcm aleppo cpc training sixth session
Acm aleppo cpc training sixth sessionAhmad Bashar Eter
 
Particle tracking
Particle trackingParticle tracking
Particle trackingbagustris
 

Similar to GUI based Face detection using Viola-Jones algorithm in MATLAB. (20)

Scale invariant feature transform
Scale invariant feature transformScale invariant feature transform
Scale invariant feature transform
 
Data Science - Part XVII - Deep Learning & Image Processing
Data Science - Part XVII - Deep Learning & Image ProcessingData Science - Part XVII - Deep Learning & Image Processing
Data Science - Part XVII - Deep Learning & Image Processing
 
Binary Features for Object Detection and Landmarking
Binary Features for Object Detection and LandmarkingBinary Features for Object Detection and Landmarking
Binary Features for Object Detection and Landmarking
 
What goes on during haar cascade face detection
What goes on during haar cascade face detectionWhat goes on during haar cascade face detection
What goes on during haar cascade face detection
 
Miscellneous functions
Miscellneous  functionsMiscellneous  functions
Miscellneous functions
 
Module 2 topic 1 notes
Module 2 topic 1 notesModule 2 topic 1 notes
Module 2 topic 1 notes
 
Avoid Overfitting with Regularization
Avoid Overfitting with RegularizationAvoid Overfitting with Regularization
Avoid Overfitting with Regularization
 
06 image features
06 image features06 image features
06 image features
 
07 dimensionality reduction
07 dimensionality reduction07 dimensionality reduction
07 dimensionality reduction
 
Convolutional neural network complete guide
Convolutional neural network complete guideConvolutional neural network complete guide
Convolutional neural network complete guide
 
Rahat & juhith
Rahat & juhithRahat & juhith
Rahat & juhith
 
my math on calculus mathematics for college
my math on calculus mathematics for collegemy math on calculus mathematics for college
my math on calculus mathematics for college
 
Alice 3
Alice 3Alice 3
Alice 3
 
Chapter3.pptx
Chapter3.pptxChapter3.pptx
Chapter3.pptx
 
Facial Expression Recognition
Facial Expression RecognitionFacial Expression Recognition
Facial Expression Recognition
 
Facial Expression Recognition via Python
Facial Expression Recognition via PythonFacial Expression Recognition via Python
Facial Expression Recognition via Python
 
Predicting Facial Expression using Neural Network
Predicting Facial Expression using Neural Network Predicting Facial Expression using Neural Network
Predicting Facial Expression using Neural Network
 
Sorting-algorithmbhddcbjkmbgjkuygbjkkius.pdf
Sorting-algorithmbhddcbjkmbgjkuygbjkkius.pdfSorting-algorithmbhddcbjkmbgjkuygbjkkius.pdf
Sorting-algorithmbhddcbjkmbgjkuygbjkkius.pdf
 
Acm aleppo cpc training sixth session
Acm aleppo cpc training sixth sessionAcm aleppo cpc training sixth session
Acm aleppo cpc training sixth session
 
Particle tracking
Particle trackingParticle tracking
Particle tracking
 

Recently uploaded

Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 

Recently uploaded (20)

Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 

GUI based Face detection using Viola-Jones algorithm in MATLAB.

  • 8. Viola-Jones Algorithm Viola-Jones outlines a box and searches for a face within the box. It is essentially searching for these haar-like features, which will be explained later. The box moves a step to the right after going through every tile in the picture. In this case, we have used a large box size and taken large steps for demonstration, but in general, you can change the box size and step size according to your needs.
  • 9. Haar-Like Features With smaller steps, a number of boxes detect face-like features (Haar-like features) and the data of all of those boxes put together, helps the algorithm determine where the face is.
  • 10. Haar-Like Features The features on right show a box with a light side and a dark side, which is how the machine determines what the feature is. Sometimes one side will be lighter than the other, as in an edge of an eyebrow. Sometimes the middle portion may be shinier than the surrounding boxes, which can be interpreted as a nose.
  • 11. Haar-Like Features There are 3 types of Haar-like features that Viola and Jones identified in their research: • Edge features • Line-features • Four-sided features
  • 12. Haar-Like Features These features help the machine understand what the image is. Imagine what the edge of a table would look like on a b&w image. One side will be lighter than the other, creating that edge like b&w feature as you can see in the picture.
  • 13. Haar-Like Features In the two important features for Face Detection, the horizontal and the vertical features describe what eyebrows and the nose, respectively, look like to the machine. Additionally, when the images are inspected, each feature has a value of its own. It’s quite easy to calculate: Subtract White area from the Black area.
  • 14. Haar-Like Features Imagine our haar-like feature was converted into a grid. Each square represents a pixel. For demonstration, we choose a 4 x 8 grid, but in reality, there would be many more pixels and thus a much larger grid for a certain feature. The numbers in the boxes represent the darkness of the features. The higher it is, the darker the pixel. Thus, you can see the numbers are higher on the right side than on the left side. Now if you add up the numbers on the two left-sided (white) columns, and subtract it from the sum of the right-sided columns, you will get the value of the particular feature.
  • 15. Haar-Like Features So in this case, the value of our feature is → (0.5 + 0.4 + 0.5 +0.6 + 0.4 + 0.7 + 0.5 + 0.4 + 0.4 + 0.5 + 0.6 + 0.8 + 0.5 + 0.7 + 0.6 + 0.6) - (0.1 + 0.1 + 0.2 + 0. 2+ 0.2 + 0.1 + 0.2 + 0.2 + 0.2 + 0.3 + 0.2 + 0.1 + 0.2 + 0.3 + 0.2 + 0.2) B - W= 8.7 - 3 = 5.7
  • 16. Integral Image In reality, these calculations can be very intensive since the number of pixels would be much greater within a large feature. The integral image plays its part in allowing us to perform these intensive calculations quickly so we can understand whether a feature of a number of features fit the criteria.
  • 17. Integral Image Now imagine the one highlighted in red is our grid for a certain feature, and we are trying to calculate the value of that feature. Normally we would just add up the boxes, but since that can be computationally intensive, we will create an integral image.
  • 18. Integral Image To calculate the value of a single box in the integral image, we take the sum of all the boxes to its left.
  • 19. Integral Image The green box in the integral image is calculated as the sum of the highlighted area in the regular image. If we did this for every box, we would have a sequence going through the grid and it may look something like the image below. All we have to do is look at the 4 corners of our feature, and add the purples, subtract the greens. → 168–114 + 79–110 = 23
  • 20. Why Integral Image? Haar-like features are actually rectangular, and the integral image process allows us to find a feature within an image very easily as we already know the sum value of a particular square and to find the difference between two rectangles in the regular image, we just need to subtract two squares in the integral image. So even if you had a 1000 x 1000 pixels in your grid, the integral image method makes the calculations much less intensive and can save a lot of time for any facial detection model.
  • 22. Conditions For Eyes & Upper Body Detection