simple face detection system ali arab sharif university of tech. fall 2012
TRANSCRIPT
Simple Face Simple Face Detection Detection systemsystem
Ali ArabAli Arab
Sharif university of Sharif university of tech.tech.
Fall 2012Fall 2012
22
outlineoutline What is face detection?What is face detection? ApplicationsApplications Basic conceptsBasic concepts
ImageImage RGB color spaceRGB color space
Normalized RGBNormalized RGBHSL color spaceHSL color space
Algorithm descriptionAlgorithm description
33
What is face What is face detectiondetection
Given an image, tell whether Given an image, tell whether there is any human face, if there is any human face, if there is, where is it (or where there is, where is it (or where they are).they are).
ApplicationsApplicationsautomatic face recognition systems automatic face recognition systems Human Computer Interaction systemsHuman Computer Interaction systemssurveillance systemssurveillance systemsFace tracking systemsFace tracking systemsAutofocus camerasAutofocus camerasEven energy conservation!!!Even energy conservation!!!
The system can recognize the face direction of The system can recognize the face direction of the TV user. When the user is not looking at the the TV user. When the user is not looking at the screen, the TV brightness is lowered. When the screen, the TV brightness is lowered. When the face returns to the screen, the brightness is face returns to the screen, the brightness is increased.increased.
44
What is an image?What is an image?We can think of an We can think of an image image as as
a Matrix.a Matrix.Simplest form : Binary imagesSimplest form : Binary images
55
What is an image? What is an image? (cont.)(cont.)
77
Color images :Color images :
Known as RGB color space
rg spacerg space
88
Normalized RGB :Normalized RGB : a color is represented by the proportion a color is represented by the proportion
of red, green, and blue in the color, of red, green, and blue in the color, rather than by the intensity of each.rather than by the intensity of each.
Removes Removes the intensity information.ntensity information.
r = R/(R+G+B)g = G/(R+G+B)
HSL color spaceHSL color space
99
Motivation:Motivation:the relationship between the constituent the relationship between the constituent amounts of red, green, and blue light and amounts of red, green, and blue light and the resulting color is unintuitive. the resulting color is unintuitive.
HSL color spaceHSL color space
1010
Each pixel is represented using Each pixel is represented using Hue, saturation and lightness.Hue, saturation and lightness.
You need to know how You need to know how to convert from RGB to HSL!to convert from RGB to HSL!
Algorithm Algorithm descriptiondescription
We use a simple Knowledge-We use a simple Knowledge-based algorithm to accomplish based algorithm to accomplish the task:the task:
This approach represent a face using a set This approach represent a face using a set of rules , Use these rules to guide the of rules , Use these rules to guide the search process.search process.
1111
Algorithm Algorithm description description
First step: First step: skin pixel skin pixel classificationclassificationConvert RGB to HSL.Convert RGB to HSL.
In HSL color space:In HSL color space:
The goal is to remove the maximum The goal is to remove the maximum number of non-face pixels from the number of non-face pixels from the images in order to focus to the images in order to focus to the remaining skin-colored regions.remaining skin-colored regions.
1212
If H<20 or H>=239 , Can be skin , otherwise reject it.
Algorithm Algorithm description (cont.)description (cont.)
First step: First step: skin pixel skin pixel classificationclassificationConvert RGB to rg space.Convert RGB to rg space. In rg chromaticity space:In rg chromaticity space:
1313
Let :
Algorithm Algorithm description (cont.)description (cont.)
Result of skin classification:Result of skin classification:
1414
Algorithm Algorithm description (cont.)description (cont.)
Consider each connected Consider each connected region as an object.region as an object.
1515
Algorithm Algorithm description (cont.)description (cont.)
second step: second step: connected connected components labelling.components labelling.
1616
Binary image before labelling:
Algorithm Algorithm description (cont.)description (cont.)
second step: second step: connected connected components labelling.components labelling.
1717
Binary image after labelling:
Algorithm Algorithm description (cont.)description (cont.)
second step: second step: connected connected components labelling.components labelling.
1818
You can find an efficient algorithm for labelling here :
http://www.codeproject.com/Articles/336915/Connected-Component-Labeling-Algorithm
Algorithm Algorithm description (cont.)description (cont.)
Third step: Third step: connected connected component analysiscomponent analysisAnalysing the labelled image.Analysing the labelled image.Giving us features of each Giving us features of each
object like:object like:AreaAreaMinimum bounding boxMinimum bounding box
1919
Algorithm Algorithm description (cont.)description (cont.)
Forth step:Forth step:objects smaller than the minimum objects smaller than the minimum
face area are removed face area are removed (smaller (smaller than 450 )than 450 )
Objects bigger than the maximum Objects bigger than the maximum face area are removed face area are removed (larger than (larger than 4500)4500)
2020
Algorithm Algorithm description (cont.)description (cont.)
2121
The resulted image until now: The resulted image until now:
Algorithm Algorithm description (cont.)description (cont.)
Fifth step : Fifth step : percentage of skin percentage of skin in each bounding boxin each bounding boxif precentage > 0.9 if precentage > 0.9
oror if percentage <0.4 if percentage <0.4
2222
region is rejected.
Algorithm Algorithm description (cont.)description (cont.)
sixth step: sixth step: eliminating based eliminating based on golden ratioon golden ratio(height / width) ratio ≈ golden (height / width) ratio ≈ golden
ratio (1.618)ratio (1.618)
2323
width
Algorithm Algorithm description (cont.)description (cont.)
And the last step: And the last step: counting the counting the holes. (optional)holes. (optional)For remaining objects we compute For remaining objects we compute
the number of holes. the number of holes. Eyes , mouth and nose usually are Eyes , mouth and nose usually are
darker, so they appear as holes in darker, so they appear as holes in binary image.binary image.If an object has no hole , we simply If an object has no hole , we simply reject it!reject it!
2424
Algorithm Algorithm description (cont.)description (cont.)
And the last step: And the last step: counting counting the holes. (optional)the holes. (optional)How??How??
In each bounding box invert the In each bounding box invert the pixels and count the objects in pixels and count the objects in new image using the labelling new image using the labelling algorithm discussed before. algorithm discussed before.
2525
Algorithm Algorithm description (cont.)description (cont.)
Remaining objects are facial Remaining objects are facial regions.regions.
2626
Final ResultFinal ResultWe can draw a bounding box We can draw a bounding box
for each face or just report for each face or just report the position.the position.
2828
RemarksRemarksYou’re not allowed to use any You’re not allowed to use any
image processing library like image processing library like cx_image or openCV.cx_image or openCV.
Collaboration encouraged, Collaboration encouraged, but the work must be done but the work must be done individually.individually.
2929