top of page
Haar Features or Haar Classifiers (1st DSP)
Haar features are rectangular digital image features used to locate human faces on an image.
​
Here are two examples of Haar Features:
edge features can detect edges effectively
linear features can detect lines effectively
An example of an edge feature on the face is the contrast between the eyebrow and forehead. The eyebrow are darker than the forehead.
​
An example of a linear feature on the face is the contrast between the eyes and the nose. The eyes and the surrounding are darker than the line on the nose.
The filters on the Viola-Jones Algorithm uses Haar Features to detect a face.
See how this works with Viola-Jones
Haar-Features
Viola-Jones
Viola-Jones Algorithm
Viola Jones algorithm is the first object detection framework to provide high accuracy when detecting objects. It was introduced by Paul Viola and Michael Jones on 2001.
​
In this project, we use this algorithm with the main purpose of detecting faces but it can be trained to detect other objects.
​
Here is an overview of how the algorithm detect faces:
​
1. Set a minimum and a maximum 2. Slide the window vertically
window size. and horizontally through the image
​
​
​
​
​
​
3. At each window position, a set of N face recognition filters are applied. If a filter returns positive, then a face is detected in the current window.
​
4. When there are no more possibilities to slide through the image with the current window size, the size is increased and the same procedure is done until the window size reaches the maximum size.
How the filters work:
Image
Sub-window
Classifier 1
Classifier 2
Classifier M
Yes
Yes
...
NO
NO
NO
Face
Yes or No?
Classifier 1
If detected (YES)
Classifier 2
Classifier1 can be
an edge Haar Feature
that find the contrast
between the eyes
(which are darker)
with the forehead
(which is lighter)
Classifier2 can be
a linear Haar Feature
that find the contrast
between the eyes
(which are darker)
and the nose
(which is lighter)
If the window pass the M classifiers, then a face is detected on the current window size.
In Practice
Haar Features in Practice
Viola-Jones Algorithm will compare how close the real case delta is to the ideal case.
​
1. Calculate the average intensity of the dark pixels
​
2. Calculate the average intensity of the light pixels
​
3.Subtract light from dark average.
delta ideal = 8/8 - 0/8 = 1
​
delta real = 0.775 - 0.175 = 0.6
The closest the real delta is from the ideal delta, the higher chance a Haar Feature is detected on the current window.
Image Processing
Image Processing (2nd DSP)
-
At the beginning of the project we tried to convert the images to grayscale to make it easier for the algorithm to detect the faces properly.
-
We also tried changing the background to black/white to remove background noise. (Not end up using it)
-
We also use cropping and resizing to store the faces on the database because the HOG Features require images to be of the same size.
HOG Features
Histogram of Oriented Gradients (HOG) Features
(Out of class DSP)
-
Partitions image into “cells”.
-
“Integrates” each cell to detail and give a value to any hard angles and edges.
-
The program then populates vectors with these values for each cell.
-
Good form of data for use in image detection and comparison.
Mapping of the hard angles found in separate sections of an image
bottom of page