Face Detecting
Face Detecting
Republic of Yemen
Mechatronics Engineering
Sana'a University
Department
Nader A. Noaman
+967771520215
DATE OF REPORT
Human face detection by computer systems has become a major field of interest. Face
detection algorithms are used in a wide range of applications, such as security control, video
retrieving, biometric signal processing, human computer interface, face recognitions and
image database management. However, it is difficult to develop a complete robust face
detector due to various light conditions, face sizes, face orientations, background and skin
colors. In this report, we propose a face detection method for color images. Our method
detects skin regions over the entire image, and then generates face candidates based on a
connected component analysis. Finally, the face candidates are divided into human face and
non-face images by an enhanced version of the template-matching method. Experimental
results demonstrate successful face detection over the EE368 training images.
INTRODUCTION
There have been many attempts to solve human face detection problem. The early
approaches are aimed for gray level images only, and image pyramid schemes are necessary
to scale with unknown face sizes. View-based detectors are popular in this category, including
Rowley’s neural networks classifier [1], Sung and Poggio’s correlation templates matching
scheme based on image invariants [2] and Eigen-face decomposition [3]. Model based
detection is another category of face detectors [4]. For color images, various literatures have
shown that is possible to separate human skin regions from complex background based on
either YCbCr or HSV color space [5, 6, 7, 8]. The face candidates can be generated from the
identified skin regions. Numerous approaches can be applied to classify face and non-face
from the face candidates, such as wavelet packet analysis [6], template matching for faces,
eyes and mouths [8, 9, 10], feature extraction using watersheds and projections [5]. In this
project, a new face detector for color images is developed. The objective of this project is to
develop a very efficient algorithm, in terms of low computational complexity, with the
maximum number of face detections and the minimum number of false alarms. To achieve
these objectives first, the image is transformed to HSV color space, where the skin pixels are
determined. The skin regions in HSV space are described by crossing regions of several 3D
linear equations, which are found using training data. Also, the median luminance condition Y
value of the image is determined. For high luminance images, the chances that more non-skin
pixels are set to skin regions are high, thus an additional but simple classification on YCbCr
space is performed to remove hair pixels. Hence, a binary mask of the original image can be
obtained. This binary mask is then filtered with some image morphology processing to break
connections between faces and remove scattered noise. A connected component analysis is
followed to determine the face candidates. The final step is to determine real faces from the
face candidates using a multi-layer classification scheme. The application of this project
justifies an assumption that the faces will have approximately the same size. So, we use a
correlation template matching for the face candidates that are close to the median size. For
large boxes, convolution template matching is used instead because it is more likely that only
part of the face candidate box contains the face. Another finer level of template matching is
applied to remove hand-like non-faces and five more face templates are tested
againavoidmissing a human face. Moreover, the standard deviation of the pixel gray levels for
the face candidates is also used to remove non-faces caused by uniform skin-colorlike region,
such as floors, buildings and clothes. In the following sections, we will present the detailed
algorithm of our face detector. We will show that our detector gives 100% accuracy on six out
of seven project training images. The only missing face on one of the images is due to very
dark glasses. No false alarms are found in any of the seven images. Finally, conclusion and
future works are discussed.
WORK PROCEDURE:
First Lets see how to detect face, nose, mouth and eyes using the MATLAB built-in class and
function.
FACE DETECTION
clear all
clc
%Detect objects using Viola-Jones Algorithm
%To detect Face
FDetect = vision.CascadeObjectDetector;
%Read the input image
I = imread('jihad1.png');
%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',9,'LineStyle','-
','EdgeColor','r');
end
title('Face Detection');hold off;
NOSE DETECTION:
%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;
MOUTH DETECTION:
%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','y');
end
title('Mouth Detection'); hold off;
EYE DETECTION:
%To detect Eyes
EyeDetect = vision.CascadeObjectDetector('EyePairBig');
%Read the input Image
I = imread('jihad1.png');
BB=step(EyeDetect,I);
figure,
imshow(I);
rectangle('Position',BB,'LineWidth',4,'LineStyle','-
','EdgeColor','b');
title('Eyes Detection');
Eyes=imcrop(I,BB);
figure,
imshow(Eyes);
NOTE:
For eng jihad doesn’t detected his eyes because he wear
glasses.
GUI:
MY temporary design:
CONCLUTION:
We have presented a face detection algorithm for color images that uses color segmentation,
connected component analysis and multi-layer template-matching. Our method uses the
color information in HSV space, compensates for the luminance condition of the image, and
overcomes the difficulty of separating faces that are connected together using image
morphology processing. Finally, an enhanced version of the template-matching algorithm is
used to detect all human faces and reject the non-faces such as hands and clothes.
Experimental results have shown that our approach detected 164 out of 165 faces present in
the seven project training images (half faces are classified as non-faces). The only one missing
face is due to very dark glasses. No false alarms are raised in any of the seven images. The
average run time on ISE lab workstation is ~12 seconds. Future work will be focused on
verifying the algorithm performance against general images and studying the required
modifications to make the algorithm robust with any image.