Face Detection using
Matlab
(VOILA-JONES ALGORITHM
Face Detection is the process of distinguishing faces from non
faces of one or more people in images or videos by analysing
and comparing patterns.
Face Detection has become a very active area of
research in recent years …
Numerous applications …
Human-computer interaction (H.C.I)
Biometric analysis
Content-based coding of images and videos
Surveillance
Different Algorithms
The Kanade–Lucas–Tomasi (KLT) Algorithm
2D DCT and Self Organizing Feature Map
The Voila-Jones Algorithm
Voila-Jones Algorithm
The first object detection framework
Proposed in 2001 by Paul Viola and Michael Jones
Primarily for the problem of face detection
Characteristics of Viola–Jones algorithm
Robust
Real time
Face detection only
Stages of The Algorithm
Haar Feature Selection
Creating an Integral Image
Adaboost Training
Cascading Classifiers
MATLAB implementation of Viola–
Jones algorithm
%To detect Face
FDetect = vision.CascadeObjectDetector;
%Read the input image
I = imread('ironman.jpg');
%Returns Bounding Box values based on number of objects
BB = step(FDetect,I);
figure,
imshow(I); hold on
for i = 1:size(BB,1)
rectangle('Position',BB(i,:),'LineWidth',5,'LineStyle','-','EdgeColor','r');
end
face=imcrop(I,BB);
figure,imshow(face);
title('Face Detection');
hold off;
MATLAB implementation of Viola–
Jones algorithm
%To detect Nose
NoseDetect = vision.CascadeObjectDetector('Nose','MergeThreshold',16);
BB=step(NoseDetect,I);
figure,
imshow(I); hold on
for i = 1:size(BB,1)
rectangle('Position',BB(i,:),'LineWidth',4,'LineStyle','-','EdgeColor','b');
end
title('Nose Detection');
hold off;
MATLAB implementation of Viola–
Jones algorithm
%To detect Mouth
MouthDetect = vision.CascadeObjectDetector('Mouth','MergeThreshold',16);
BB=step(MouthDetect,I);
figure,
imshow(I); hold on
for i = 1:size(BB,1)
rectangle('Position',BB(i,:),'LineWidth',4,'LineStyle','-','EdgeColor','r');
end
title('Mouth Detection');
hold off;
MATLAB implementation of Viola–
Jones algorithm
%To detect Eyes
EyeDetect = vision.CascadeObjectDetector('EyePairBig');
%Read the input Image
I = imread('harry_potter.jpg');
BB=step(EyeDetect,I);
figure,imshow(I);
rectangle('Position',BB,'LineWidth',4,'LineStyle','-','EdgeColor','b');
title('Eyes Detection');