AUTOMATIC FACE DETECTION Sheffield Hallam University Page 1 PREFACE This report describes that the project work carried out in the Faculty of Arts, Computing, Engineering and Sciences at Sheffield Hallam University between June and September 2010. The submission of the report is in accordance with the requirements for the award of the degree of MSC Telecommunication & Electronics Engineering under the auspices of the University.
67
Embed
AUTOMATIC FACE DETECTION - Dr. Hussein S Abdul-Rahmanhsnemer.weebly.com/uploads/7/6/2/1/7621583/khaleel_masterthesis… · AUTOMATIC FACE DETECTION Sheffield Hallam University Page
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 1
PREFACE
This report describes that the project work carried out in the Faculty of Arts, Computing, Engineering and Sciences at Sheffield Hallam University between June and September 2010.
The submission of the report is in accordance with the requirements for the award of the
degree of MSC Telecommunication & Electronics Engineering under the auspices of the
University.
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 2
ACKNOWLEDGEMENT
First of all I would like to thanks Almighty for all His kind blessings without which my work
has been knock-off. Also I would like to give the credit to the people who remember me in
their prayer for my achievements.
I take an opportunity to express my gratitude to Dr. HUSSEIN ABDUL RAHMAN, senior
faculty of Sheffield Hallam University for his constant support, valuable suggestions and
great ideas which enhance my level of performance. He also motivated me by providing apart
from his vast knowledge and sapience.
I would like to appreciate the faculty members management of university for providing me
great support through out my master course of education. Last but not the least, I would
honour to thanks my parents, brother and sisters for their encouragement and confidence on
Department of Arts, Computing, Engineering and Sciences. Sheffield Hallam University.
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 3
Declaration I declare that, all the material contained in this document is solely my work except where it is indicated through proper citations and references. No part of this work has been submitted to any other university for a degree or any other qualification. September, 2010 Khaleel Uddin Mohammed. Sheffield, UK M.sc Telecommunication & Electronics, 2010. Department of Arts, Computing, Engineering and Sciences. Sheffield Hallam University.
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 4
ABSTRACT
Human face recognition systems have gained a considerable attention during last
decade due to its vast applications in the field of computer and advantages over previous
biometric methods. There are many applications with respect to security, sensitivity and
secrecy. Face detection is the most important and first step of recognition system.
Human face detection suffers from various challenges due to variation regarding
image conditions, size, resolution, poses and rotation. Its accurate and robust detection has
been a great task for the researchers. There exist various numbers of methods and techniques
for face detection but none can guarantee successful in all conditions for all kinds of faces
and images. Some methods are exhibiting good results in certain conditions and others are
good with different kinds of images. Face detection based on skin colour is found to be more
effective technique because of the properties of skin colour which is unique and can be easily
separated from the other objects present in the image and background.
Key Words: Face recognition, Face detection.
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 5
CONTENTS
Preface
Acknowledgement
Declaration
Abstract
Content
List of Figures 1 Introduction 1
1.1 Over view 2
1.2 Aims and Objective 2
1.3 Expected Output 2
1.4 What is Face Detection 2
1.4.1 Challenges 3
1.5 Thesis Structure 3
2 Literature Review 5
2.1 Background 6
2.2 Literature survey 7
2.3 Case studies 7
2.3.1 Case study-1 7
2.3.2 Case study-2 7
2.4 Methods of Face Detection 8
2.4.1 Knowledge Based Method 8
2.4.2 Feature Based Method 9
2.4.3 Template Based Method 10
2.4.4 Appearance Based method 11
2.5 Difference Between Face Detection and Face Recognition 11
2.5.1 Sensor Module 12
2.5.2 Face detection and Extraction of Facial Feature 12
2.5.3 Classification Module 12
2.5.4 System Database Module 12
3 Introduction to Image Processing 14
3.1 What is Image 15
3.2 What is Pixel 15
3.3 Image Processing 15
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 6
3.4 Image Enhancement 15
3.5 Image Restoration 16
3.6 Colour Image Processing 17
3.6.1 Radiance 19
3.6.2 Luminance 19
3.6.3 Brightness 19
3.6.4 Hue 19
3.6.5 Saturation 19
3.7 Image Segmentation 20
3.8 Edge Detection 20
3.9 Histogram Processing 21
3.10 Thresholding 22
4 MATLAB 24
4.1 MATLAB 25
4.2 MATLAB System 25
4.3 Advantages of MATLAB 26
4.4 Disadvantages of MATLAB 27
4.5 MATLAB Windows 27
4.6 Script Files 28
4.7 Arrays 29
4.8 Control Flows 30
4.8.1 For Loop 30
4.8.2 While Loop 31
4.8.3 If-Else-End Construction 31
4.8.4 Switch-Case Constructions 32
4.8.5 Try-Catch Block 32
4.9 Application areas of MATLAB 32
4.10 Key Features 33
4.11 MATLAB for Image Processing 33
4.12 Image Formats and Types Supported by MATLAB 34
4.12.1 Binary Images 34
4.12.2 Indexed Images 34
4.12.3 Grayscale Images 35
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 7
4.12.4 True Colour Images 35
5 Algorithms, Results and Comparisons 36
5.1 Colour Models 37
5.1.1 RGB Colour Space 37
5.1.2 HSI (Hue, Saturation, Intensity) Colour Space 38
5.1.3 YCrCb Colour Space 38
5.2 Algorithms 39
5.2.1 Skin Colour Based Face detection in RGB Colour Space 39
5.2.2 Skin Colour Based Face Detection in YCrCb Colour Space 39
5.2.3 Skin Colour Based Face Detection in HSI Colour Space 41
5.3 Proposed Algorithm For Face Detection 43
5.4 Experimental Results 44
6 Discussion, Conclusion and Future Work 49
6.1 Discussion 50
6.2 Conclusion 50
6.3 Future Work 51
7 References
8 Appendixes
8.1 MATLAB Code
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 8
LIST OF FIGURES
FIGURE NO. NAMES OF THE FIGURES PAGE NO
2.4.3.1 Face template for face localization 10
3.4.1 Eyes 16
3.4.2 X-ray 16
3.5.1 Image restoration 17
3.6.1 Refraction of light 18
3.6.2 Gray-scale 18
3.6.3 RGB image components 19
3.8.1 Edge detection 21
3.9.1 Histogram Parts 22
3.10.1 Thresholding 23
3.4.1 Matlab window 28
4.10.1 Image coordinate systems 33
4.10.2 Spatial coordinate system 34
5.1.1.1 RGB cube 38
5.2.3.1 HSV-cone 43
5.4.1 Input image-1 45
5.4.2 Image-1 segmented 45
5.4.3 Applying RGB to segmented image-1 45
5.4.4 Image-1 after edge detection 46
5.4.5 Binarlization 46
5.4.6 Noise removed by performing Morphological operation 46
5.4.7 Output of image-1(Face detected) 46
5.4.8 Input image-2 47
5.4.9 Image-2 segmented 47
5.4.10 Applying RGB to segmented image-2 47
5.4.11 Image-2 after edge detection 48
5.4.12 Binarlization 48
5.4.13 Noise removed by performing Morphological operations 48
5.4.14 Output of image-2(Face detected) 48
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 9
Chapter-1
Introduction
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 10
1.1 Over view:
Face detection demand is growing with a rapid speed because of its vast application in
the field of computer vision. For the implementation of different security methods as such
face tracking, face recognition and expression recognition and pose estimation all this
methods requires face detection algorithm. Though its got a lots of challenges variation in
poses, illumination, facial expression and occlusion the demand of face detection is still high
because of its non-intrusive nature. Because unlike other bio-metric, face detection method
gives better identification for security and best result than any other bio-metric methods.
Face detection is not only the first step of any automatic face recognition system but also for
human computer interaction system, generic object recognition and detection and many
surveillance systems.
1.2 Aims and Objectives:
Aim of the thesis is to evaluate the face detection process using the all three colour spaces
so that advantages and application of all three colour space can club together into a single
proposed algorithm. The objectives of the thesis is
• First is to understand the different methods of face detection methods
available under which various techniques are used.
• After the analysis of different method a suitable technique is proposed which
is more accurate and have high detection ratio.
• Compare the proposed technique of face detection with the other techniques.
1.3 Expected outcome:
The expected output of the automatic face detection method based on skin colour is
the same image which is given as input to the system but with boundaries across the faces
present in the image showing the exact location and size of the image. This boundaries across
the face may be of any shape like square and circle but in the algorithm we have proposed,
accurate shapes (squares or circles) are not consider but it completely depends on the shape
of the face so that no redundant information comes into the picture.
1.4 What is Face Detection:
Face detection is defined as finding the number of face present in an image and
locating their position and size. Generally the process of face detection is partition in two
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 11
steps in the first stem the whole image is scanned to find the region (features) that can be
identified as face, skin colour is the most common among all. And the next is localisation
which gives more accurate estimation of size and position of the faces. Face detection is the
first step of human identification and recognition system.
1.4.1 Challenges: Face detection method faces are various challenges such as pose, imaging
condition.
Pose: The image of a face vary due to relative camera-face pose and some facial
feature becomes partially or completely occluded.
Image orientation: face images directly vary for different rotation about the camera’s
optical axis. Image orientation directly affects the angle of the face.
Illumination: This problem is mainly due to lighting, makes a larger difference with
the same face as compare to difference within different faces while comparing
(Javidi.Bahram, 2002).
Occlusion: Sometime, faces in the image are occluded with other objects such as
moustaches, beard, optical lenses and other types of object make it very difficult to find
accurate image.
Facial expression: Some persons may have different expression at different times,
this also contributes to challenge in face detection.
Face size: Size of the face also make difficult to automate a system for face detection
and recognition (Muhammed Tariq Mahmood, 2002).
Image condition: This problem includes factors such as intensity, resolution, camera
lighting, background, characteristics of image capturing device and distance between camera
and person, plays an important role in the process of face detection.
1.5 Thesis structure:
Chapter 1: Introduction to face detection covers the aims and objective of face
detection and also the problem faced in achieving effective face detection.
Chapter 2: Briefly describe the methods of face detection and explain the difference
between the face detection and face recognition.
Chapter 3: It gives the clear picture of image processing and the different fields of
image processing.
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 12
Chapter 4: This chapter deals with the MATLAB tools and image formats supported
of MATLAB. And also describe the control flows of MATLAB.
Chapter 5: In this chapter three colour spaces and their algorithms along with the
proposed algorithm are discussed in depth.
Chapter 6: The final chapter if this thesis discussions and future work on the face
detection method is carried out.
Chapter 7: This chapter composes of code of the algorithm proposed on skin colour
based face detection.
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 13
Chapter-2
Literature Review
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 14
2.1 Back ground:
From the advent of cell phones in the electronics history till today there is continuous
development in the technology used in the cell phones. Modern cell phones have so many
features such as integrated cameras, high resolution display, multiple communications
interfaces, and processing power and many more equal to at least, to a mid-1990’s PC. Cell
phones are most widely distributed in terms of range of users, geographical distribution than
any other class of computers. This makes them an attractive development platform for many
image processing and computer vision algorithms. Among this algorithms face detection is
early step in many computer vision systems, including Video communication, Super video
compression, Face recognition, Video surveillance, Responsive user interface, Video-
augmented speech understanding, Intelligent autofocus etc.
Video communication: A high quality image with fixed bandwidth can be obtained
by compressing the detected image at lower compression rate than the background.
Super video compression: Once a face is detected, it can be matched with some pre-
recorded faces of the presenter and then the chosen face index transmitted and displayed,
resulting in an satisfactory video experience using very small bandwidth.
Face recognition: After detecting a face it is compared with a database of known
faces, and then an appropriate response can be made when a face s recognised.
Video surveillance: Detected faces can be tracked in order to find out when a person
has entered an area of interest.
Responsive user interface: A tool may perform some pre-programmed actions when a
face is detected.
Video-augmented speech understanding: Speech understanding can be made easier by
detecting and then tracking face movements to determine which of several similar-sounding
phonemes was actually being pronounced.
Intelligent autofocus: Once a face is detected, a camera’s focus can be used to bring
the face into improved focus (Jon A.Web, 2010).
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 15
2.2 Literature Survey:
2.3 Case studies:
The case studies contain the over view of two methods of face detection using the same
technique (skin colour) with two different approaches one uses the guassian mixture model
and other uses the morphological operations.
2.3.1 Case study 1:
Face detection in colour images: Face detection is divided into three parts human skin
segmentation to describe the probable regions corresponding to face, adaptive shape analysis
to separate human faces from initial segmentation and view based face detection to further
identify the location of each human face. Human colour (skin colour) which is important
feature of human face and produces information which is invariant to face detection. Feature
space in which skin colour cluster tightly and reside remotely to background colour, is used
to effectively exploit skin colour for face detection.
YCbCr colour space is the common for face detection since it is uniform and more
important is that it separate luminance and chrominance. As many studies reveals that
chrominance an luminance must be separated from each other so that there will be no effect
of illumination (insensitive to illumination). Dispersion of skin colour is prototyped with a
Guassian mixture model (WenmiaoLu and ShaohuaSun, 2000).
2.3.2 Case study 2:
Face Detection Using Colour Based Segmentation and Morphological Processing:
This case study describe a algorithm that uses colour based segmentation and some
morphological processing. The colour based segmentation. The colour based segmentation
takes the advantage of patterns developed in only two colour spaces i.e HSI and YCrCb,
instead of three colour spaces, followed by the morphological operations and a template
matching. Different ethnic group have different degrees of the melanin and pigmentation, the
range of colours that human facial skin takes on is clearly a subspace of the total colour
space.
The steps defined for this algorithm is as follows:
1. Select an image as input.
2. Apply HSV and YCbCr colour mode.
3. Calculate skin ranges for H, Cb and Cr.
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 16
4. Obtain colour segmented image.
5. Apply open operation on the segmented image.
6. Check for holes if any. And find width and height of the region.
7. Find correlation of face with template.
8. Region consider as image ( Dr. Arti Khaparde, Sowmya Reddy.Y Swetha
Ravipudi, 2007).
2.4 Methods of face detection:
Automatically detecting human face has played a vital and challenging task in
computer vision research. The consequence of this is its vast application, since it is the first of
towards intelligent vision-based human computer interaction and it the first stage of
automatic face recognition system. Detecting human face had been a difficult and challenging
task since it involves the many problem such as image size, face size, face angle, pose,
features extraction, type and many more. For this there are number of methods and
algorithms are developed each has its own significance. The four categories of face detection
algorithms are as follows
2.4.1 Knowledge based method:
This method relies completely on the simples rules which describe the features of the
face and the relation (for example distance) between them such as there exist a uniform
intensity in the central region of the face and also eyes are symmetric to each other. The
search algorithms guided by the rules are applied to find the target face [Yang, Ming-Hsuan,
2001]. The other features may be chin, nose and eyebrows. A hierarchical approach which
studies the face at various resolution can be used. At top level faces of the people present in
the image are taken out roughly and in the low level facial features are extracted thus
separating the face with the non-face region accordingly depending up on the rules defined on
the facial features.
Yang and Huang introduce a knowledge based method also known as top down
method in 1994. This method is divided in three stages. In the first stage high rules are
defined and in the second stage edge detection techniques is done using histogram and
equalization methods.
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 17
Knowledge based method is good for the frontal image thus finds difficulty in
detecting faces in taken at different poses or head orientation. This is because it is not easy to
translate human knowledge about the rules into definite rules. In practice this method of face
detection is not often used.
2.4.2 Features based method:
The central theme of this method is to find the features of the face that are invariant or
not affected by any factors such as variation in lighting conditions, pose and others. The
different features that can be used are eyes, eyebrows, mouth, nose, face shape, texture and
skin colour which are extracted using the derivatives filters, edge detectors, morphological
operations or thresholding. Statistical analysis is done to get the relationship and verify the
presence of faces.
Skin colour is one of the powerful and effective features to detect the face since it has
the colour thus colour scene segmentation is computationally fast. The other important of
skin colour as facial feature to detect face is it is robust to changes in the view point, complex
background and shading to partial occlusion. Though geographically, people of different
country has different skin colour. This difference lies in their intensity not on their
chrominance. The unique texture of skin colour is used to separate it from different object
present in the image. Each pixel of the image is labelled according to its similarity with the
skin colour and then the regions are made as face if it contains skin colour pixel above a
particular number(threshold) and non-face for the region is it contain less than the threshold.
This colour based method is sensitive to light, occlusion, adjacent faces ant also if the
features are corrupted severely. And it is also find difficulty in detecting face in complex
background.
Feature detection method is completely based on detecting feature of the face. Edge
detection one of the technique used to detect the features and followed by grouping the edges
and other is to use blob and streak instead of edges. For example in the face model eyes, nose
and cheeks bones are represented as two dark blobs and three light blobs. For the facial
features such as outlines of eyebrows and lips, streak model is used. To improve the detection
accuracy multi features methods that combines several features is used. Firstly to detect the
face by using features such as skin colour, texture and shape and lastly to verify these using
features such as nose, hair and eyebrows.
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 18
2.4.3 Template based method:
In this method a large number of templates of faces are stored into the system. The
input image from which the faces is to be detected is processed by making head outline which
is elliptical (roughly) is made using edge detector and filters. After that a contours (line
joining the facial features) of the facial features are drawn which gives the information about
face and features geometry. After all, the correlation between the predefined stored templates
and the features extracted from the input image is computed to know whether there exist a
face in the image or not. As it is a correlation process input images with different poses,
scales and shapes are sensitive parameters. To overcome this sensitive parameters deformable
template method have been proposed which allow to scale, translate and rotate by using
elastic model which model the geometry of the face. Parameters of the model can be not only
the shape but also intensity information of facial features. P.Sinha [1994] utilises a group of
images invariants to describe the face pattern. The different parts of the face have different
brightness for example the brightness of the eyes and nose changes while illumination. This
methods calculated the pair wise ratios of brightness and projected directions. A face is
localised by satisfying all conditions for dark and bright regions. The figure below is the
enhance figure that have 23 defined relation for a face template.
Fig 2.4.3.1 Face template for face localization (P.Sinha, 1994)
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 19
It is difficult to define all templates of the faces thus make it unsuccessful for different
poses and illumination problems.
2.4.4 Appearance-based methods:
Similar to template based method templates are learned by computer system in the
form of training algorithms which classify the regions into two types of classes there are face
or non-face class. The face class shows the images that contain the face images and the non-
face class shows the images other than the images of face class that is anything that is not a
face. For learning face and non-face classes machine learning algorithm is used. All
techniques used under appearance based methods have common steps there are classification
of face and non face classes, pre-processing, learning and post processing of the images.
Statistical analysis and machine learning techniques are used to determine the probability
distribution function of the pixel brightness patterns of images of the two classes. The names
of some famous appearance based methods are hidden Markov, neural networks, Adaboost,
decision tree, eigen faces, LDA and decision tree model.
2.5 Difference between face detection and face recognition:
The immense application of face recognition, its has became a popular area of
research in field of computer vision. Due to its ability of problem solving, it has gained
attention of not only computer researchers but also psychologist ant neuroscientist. The
increase in commercial and law enforcement application commanding personal
authentication for people’s surveillance, transaction security, the name face recognition
becomes famous. The other bio-metrics techniques which are also more reliable such as
fingerprints and iris recognition which are intrusive and they need the assistance of user
unlike face recognition which is non-intrusive as it is grounded completely on images
recorded from a distant by a camera. And the most important thing is that it does not required
user assistant and works even when the user has no idea about the existence of the face
recognition system. Face gives much information about the person in personal identification
system than the finger and iris does.
Face recognition works in two modes there are face identification and face
verification. Face identification works by matching the input image with the images stored in
the computer/database and in face verification the user gives an identity as an input to the
system and the machine accepts or reject depending on matching process performed on input
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 20
image and the images stored in the database with this specific identity (Filareti Tsalakanidou ,
Sotiris Malassiotis 2 and Michael G. Strintzis, 2009).
A face recognition system comprises of four modules there are as follows:
2.5.1 Sensor module:
This module captures face images, depending upon the requirement the image
acquisition device can be black and white camera or the colour camera.
2.5.2 Face detection and extraction of facial features:
The input images are scanned to detect the presence of face and window the location
containing only the face area. After finding the exact location and size of the face, irrelevant
information (neck, hair, shoulders and background) are cast aside which will help in
extracting of facial features used by face classifier to verify the identity of unknown face.
2.5.3 Classification Module:
In this module, comparison of the template or images extracted from the face
detection process and the a large set of stored images or templates in the database is done and
generate matching scores which gives the information about how identical the two images
are. A decision making module then perform either verification or identification on the basis
of matching score. For face verification, the matching score is compared with predefined
threshold and on the basis of comparison the user is accepted or rejected. For the face
identification, a set of matching scores between the extracted templates and the images or
templates of enrolled users is calculated. If the matching score is good, indicates that the user
face (unknown) is more similar to the face in the template stored in the database than any
other templates. To conform that unknown face is actually the one stored in the database,
matching score is compared with the predefined threshold (in the database).
2.5.4 System database module:
Database module is used to stack the templates of the entered (enrolled) users and also
solely responsible for enrolling users in the database of face recognition system. Sensor
module reads the images of his/her face and they are stored in database for training the
classifier, the stored images are termed as gallery images. If feasible these images are stored
in more than one session depending upon the face variations such as hairstyle, beard, make-
up, etc this enhance the performance of face recognition system. The training algorithm
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 21
determines the different values of threshold. The training algorithm is, for instance given
some images as input, then the features are extracted as process defined in the above step and
the template that provides much similar information as that of the input image are generated
and this are called training. This training algorithm depends on the method of face
recognition. The aim of the training is to encode the most discriminative quality of a user
based on the classifier selected, and to find out the values of the different thresholds (Filareti
Tsalakanidou , Sotiris Malassiotis 2 and Michael G. Strintzis, 2009).
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 22
Chapter-3
Introduction to Image Processing
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 23
3.1 What is Image:
A Two dimensional function, f(x, y) with x and y are spatial coordinates is termed as
Image and the amplitude of function f(x, y) at any point of coordinates (x, y) is called as
intensity of the image or the gray level. If the value of x, y and the amplitude of f(x, y) are
discrete than the image is said to be digital image.
3.2 What is Pixel:
Pixel is the basic, smallest discrete component of the image that can be controlled.
Each pixel has particular location and value. They are also called as pels, picture elements,
image elements.
3.3 Image Processing:
The term Digital image processing refers to processing of two dimensional data
(image) and the term digital image refers to an array of real or complex number represented
by finite number of bits.
Digital image processing has broad range of applications, such as remote sensing via
satellites and spacecrafts, medical processing, radar and acoustic image processing and
robotics.
There are various applications of image processing comes out of different fields of it.
The different fields of image processing are as followed.
Image enchancement
Image restoration.
Colour image processing
Image segmentation
Edge detection
Histogram processing
3.4 Image Enhancement:
According to David Lindsay image enhancement is : All that makes the difference
whether one sees darkness through the light or brightness through the shadows.
The main objective of enhancement is to improve the quality of images for human
visualisation and analysis that is making it(images) more suitable for a specific application.
Increasing contrast, removing blurring and noise are some of the operation of enhancement.
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 24
Image enhancement approaches are classified into two categories: spatial domain method and
frequency domain method. Spatial domain techniques are based on the location of pixels in
the image and frequency domain techniques are based on changing the Fourier transform of
an image. There are various techniques of image enhancement some of them are contrast
stretching, Power-law transformation, Gray level slicing, Bit-plane slicing etc. (Rafael C.
Gonzalez and Richard E. Woods, 2001)
Fig 3.4.1 Eyes (Zia-ur Rahman, 2001)
Fig 3.4.2 X-ray (Zia-ur Rahman, 2001)
3.5 Image Restoration:
Immanuel Kant: ‘’Things which we see are not by themselves what we see....It
remains completely unknown to us what the object may be by themselves and apart from the
receptivity of our senses. We know nothing but our manner of perceiving them.’’
The difference between the image enhancement and image restoration is that image
enhancement is subjective process whereas image restoration is largely objective process.
Image restoration is used to fix the color, the contrast, the tone and to repair damages which
is caused due to non-linear filtering produced by sensors, geometry distortion correction,
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 25
noise filtering and environmental limitation. Thus restoration techniques are pointed toward
modelling the degradation and putting on the inverse process in order to retrieve the original
image. the following figures will shows the best result of image restoration.
Fig 3.5.1 Image restoration (ozlouisville)
3.6 Colour Image Processing:
Pablo Picasso: ‘’for a long time I limited myself to one colour-as a form of discipline.
The use of colour in image processing is encouraged by two factors since colour often
help in object identification and extraction from the images is one factor and the another
factor is human eye can distinguish thousand of colour shades and intensities and only about
two dozen shades of gray. Colour image processing is divided into two major parts: full
colour image processing and pseudo colour image processing. In full colour processing the
important thing to be noticed is from where the images are acquired (from the colour TV
camera or colour scanner). And in pseudo colour processing, the problem is of assigning
colour to a particular range of intensities. Since many years full colour image processing is
not used however from a decade, colour sensors and colour processing hardware have
available at reasonable prices resulting in utilization of broad range of application such as
publishing, visualization, and the internet.[ Rafael C. Gonzalez, Richard E. Woods, 2001]
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 26
In colour image processing, the colour spectrum is divided into six broad region:
violet, blue, green, yellow, orange and red which are formed by passing white light through
the optical prism as shown below. The colour that human perceive in an object are
determined by the nature of the light reflected from the object. The object that reflects light
that is poised in all visible wavelengths looks white to the user an the object that favours
reflectance in a confined area of visible spectrum exhibits some shades of colour. For
instance green object reflects light in the range of 500nm to 570nm (wavelength) whilst
observing most of the energy at other wavelength.
Fig 3.6.1 Refraction of light (Ian Flitcroft, 2007)
Characteristics of light plays an important role in science of colour. The lights that
comes out of the black and white television is achromatic light that is white, grey and white
are achromatic colour and the light that comes out from this colour is achromatic light (as
shown below) ranges from 400 to 700nm. Radiance, luminance and brightness are used to
define the quality of achromatic light.
Fig 3.6.2 Gray-scale (Tomás Castelazo, 2006)
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 27
3.6.1 Radiance: The net amount of energy that comes out from the light source.
3.6.2 Luminance: It is the amount of energy an observer perceives from a light source.
3.6.3 Brightness: brightness is a subjective signifier and in practical it is not possible to
measure the brightness.
Red, green and blue are the three primary colours separated from the other on the
basis of the sensing capability of cones present in human eye. Due to the absorption property
of the human eye, colours are seen as variable combination of red, green and blue which are
called as primary colour. All colours resulting from the combination of primary colour are
termed as secondary colours such as magenta, yellow, cyan and red. The characteristic that is
used to separate the colours from each other are brightness, hue and saturation.
3.6.4 Hue:
Hue represent dominant colour as perceived by the observer, it is property associated
with the colour that has dominant wavelength in a mixture of light waves.
3.6.5 Saturation:
It gives the information about the purity of the colour or the amount of white colour
mixed with hue. For instance pink is a combination of red and white colours is less saturated.
That the degree of saturation and the amount of white colour added are inversely proportional
to each other.
The combination of Hue and saturation are termed as chromaticity and hence all
colours are characterized by their brightness and chromaticity.
Fig 3.6.3 RGB image components (Gonzalez and Woods, 1992)
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 28
3.7 Image segmentation:
Segmentation is a process of subdividing an image into constituents regions or objects
so that the minute details of the image are read or analyzed. The objective of segmentation is
to change or modify the representation of the image into meaningful and simplified way (easy
to analyzed). This process comes into picture when the object of interest is to detect or
identified from a set of objects and terminate immediately after the object is isolated from the
rest, there is no point in carrying out the segmentation process past the level of detail required
to identify the object of interest.
Like that of other fields of image processing, image segmentation also got numerous
application some of them are: Diagnosis, study of anatomical structure, object location in
satellite images, military imaging etc. Generally image segmentation algorithms are based on
two properties of intensity values: discontinuity and similarity. In the category of
discontinuity, images are segmented based on abrupt changes in intensity. And in the second
category, images are partition based on the similarity exists with the predefined criteria.
Based upon the two categories of image segmentation there are various of approaches are
analyzed among them the most wanted are edge detection and thresholding.
3.8 Edge Detection:
Its is the most approach for detecting meaningful discontinuities in grey level. The
set of connected pixels that lies on the boundary between two regions are termed as edge or it
is ability of the pixels to measure the gray-level transitions in a meaningful way and the edge
detection is to detect this pixels. Images are blurred due to bad sampling and imperfections of
image acquisition. Thus the edges are more closely modelled as ‘’ ramplike ‘’ profile as
shown below. The slope of the ramp and the blurring in the image are inversely proportional
to each other. Any pixels that lies on the ramp line are said be edge point. The length of the
line which depends on scope of the line is determined by the degree of blurring. Thus, it is
found that sharp edges tends to be thin and the blurred edges tends to be thick.
In the figure shown below first and second derivative of ramp is calculated. The first
derivative is positive at the point of transition into and out of the ramp (from the left to right)
and constant throughout the ramp line. Second derivative is positive only at the instant of
transition associated with the black side, negative only at the instant of transition associated
with the light side and zero throughout the ramp line. Thus first derivative is used to identify
the presence of an edge at a point in an image and the second derivative is used to conclude
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 29
whether an edge pixel lies on dark or light side of an image. Second derivative has two
attributes, for every edge in an image it produces two values and the other is zero crossing
property. The zero crossing, an imaginary line crossing zero at the midpoint of two values of
second derivative, joining the positive and negative values.
Fig 3.8.1 Edge detection (Shehrzad Qureshi, 2009)
3.9 Histogram processing:
Its a most common technique of image enhancement. It is a vertical bar chart that
gives the information about the distribution of set of data. when a table with a large set of
measurement is given, Histogram is used to organised and display the data in more simple
and user friendly format. A Histogram will make it effortless to determine where the bulk of
values falls in a measurement scale, and how much variation there exists between them.
The following shows some of the situation where Histogram is needed:
Summarize large data sets graphically
Compare process results with specification limits
Communicate information graphically.
Help to assist in decision making.
(http://www.scribd.com/doc/6811944/Histogram-VG)
As shown below, Histogram consists of five parts:
1. Title: The title briefly describes the information contained in the Histogram.
2. Horizontal or X-Axis: The horizontal or X-axis shows you the scale of
values into which the measurements fit.
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 30
3. Bars: The bars have two important characteristics—height and width. The
height represents the number of times the values within an interval occurred. The width
represents the length of the interval covered by the bar.
4. Vertical or Y-Axis: The Y-axis is the scale that demonstrates the number
of times the values within an interval occurred which is termed as frequency.
5. Legend: The legend provides additional information for example where the
data came from and how the measurements were gathered.
Fig 3.9.1 Histogram Parts
3.10 Thresholding:
Thresholding enjoys central position in applications of image segmentation because of
its intuitive property and ease of implementation. It tries to identify an object from its
background. Intensity is the property that pixels in a region can share with each other. So, a
normal way to segment such a regions is through separation of light and dark regions which
is termed as thresholding. Its produces binary image from grey-level by bending all pixels
below some threshold to zero and all pixels about that threshold to one.[11]
If g(x,y) is a thresholding version of image f(x, y) at some global threshold T.
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 31
Fig 3.10.1 Thresholding (Lindsay come, 2005)
The problem with the thresholding is that it does not consider the relationship
between the pixels but consider only the intensity property of the image. Thus there is no
guarantee pixels identified by the thresholding process is continuous. No information is given
if an extra pixels are included or disregarded within the given region. There are various
techniques for thresholding among them the simplest is global thresholding where image
histogram is partition by using a single global threshold T. Then segmentation process is
started to scan the image pixel by pixel and labelling each as object or background based on
the gray level of the pixel is lesser or greater than the value of T. In global thresholding only
a single threshold is defined and result with a problem of changes in illumination across the
scene causes some parts to be brighter in light and some parts darker in shadow. There is one
more technique of thresholding based on several variables which is called as multispectral
thresholding.
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 32
Chapter-4
MATLAB
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 33
4.1 MATLAB:
MATLAB (is the abbreviation of MATrix LABoratory) is special purpose computer
program to perform engineering and scientific calculation. It is used for simple mathematical
calculation such as mathematics, computation as well as to solve complex problems such as
for understanding and teaching engineering concepts, data analysis, exploration,
visualisation, prototyping, analysing and simulating of actual electrical and power systems.
MATLAB is a high-level language and interactive environment chosen to perform
computationally intensive tasks faster than with traditional programming languages such as
C, C++, and Fortran ( The MathWorks, Inc., 2010).
MATLAB can be used in wide range of application such as signal processing, image
processing, control design , biological computation, finance modelling and analysis. The
most interesting feature of MATLAB is that integration of MATLAB code with other
languages and applications. In 1970s MATLAB was produced as a technical tool, because of
its huge application it has expanded and now used for car design, aerospace and many
advance researches.
Toolboxes, one of the important feature of MATLAB. Toolbox allow the user to
learn and apply specialized technology and hence preferred as a tool of choice by many
researchers. This feature of MATLAB is a collection of m-files that stretch the MATLAB to
workout for particular families of problem. Toolbox are available for the area: control
system, image processing, fuzzy logic, signal processing and many more (Khairul Anuar
Ishak, 2008).
4.2 MATLAB system:
MATLAB system consist of five main sections:
1. The MATLAB language: MATLAB language is high-level matrix language
that includes control flow statement, data structures, functions and object oriented
programming features. It allows both programming in small which produces output quickly
and also programming in large and complex programs.
2. The MATLAB working environment: these are the set of tolls and facilities
which includes facilities for managing the variables in workspace and importing and
exporting data also developing, debugging and profiling m-files.
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 34
3. Handle graphics: It is graphics system which includes commands for image
processing, animation two-dimensional and three dimensional data visualization also it
includes low level command that helps in fully customizing the appearance of graphics.
4. The MATLAB mathematical function library: it is large collection of simple
algorithms such as sine, cosine and complex arithmetic to more advanced functions such as
Bessel functions, FFT (Fast Fourier Transform), eigen values.
5. The MATLAB Application Program Interface(API): This section of
MATLAB allows to write C and Fortran programs that interact with MATLAB (Khairul
Anuar Ishak, 2008).
4.3 Advantages of MATLAB: MATLAB has many advantages over conventional computer
language, some of them are
1. User friendly: Programs written in MATLAB can be easy modified with the
built-in integrated development environment and corrected with the MATLAB debugger and
hence used for rapid prototyping of new program.
2. Platform independence: MATLAB runs on many computer operating systems
thus providing a high range of platform independence.
3. Predefined Function: MATLAB has a large numbers of functions that are
predefined that gives tested and pre-packaged solutions to many basic technical problems
such as mean, square root, standard deviation etc. Also one more special purpose tool of
MATLAB to solve the complex problems in specific areas are Toolboxes.
4. Device-Independent Plotting: MATLAB has integral plotting and imaging
commands which is not found in other languages of computer. This plots and images can be
visualized on any graphical output device installed on computer on which MATLAB is
present.
5. Graphical User Interface: MATLAB comprises of tool that permit the user to
construct a graphical user interface. With this powerful mechanism of MATLAB, even an
inexperience user can design data analysis program.
6. MATLAB Compiler: Flexibility of MATLAB lies in compiling MATLAB
program into a device-independent p-code after that interpreting the p-code instruction at
runtime which effects the execution of program since the code id interpreted instead of
compiled (Khairul Anuar Ishak, 2008).
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 35
4.4 MATLAB has two disadvantages:
The execution of program takes more time than the compiled language since it is an
interpreted language. This effect can be reduce by proper structuring the program and by the
use of MATLAB compiler to compile the final program before distribution and general
use.The cost of MATLAB is very high which is five to ten times greater than C or Fortran
compiler. But luckily student edition of MATLAB, an inexpensive, same as full edition of
MATLAB is available.
4.5 MATLAB Windows:
Windows used in MATLAB and their basics functions are as shown below.
WINDOWS FUNCTIONS
Command Issue command to MATLAB for processing
Command history Running history of prior command issued in
the command window
Launch pad Tree layout for access to tools, demos and
documentation
Current directory GUI for directory and file manipulation in
MATLAB
Help GUI for finding and viewing on-line
documentation
Workspace GUI for viewing, loading and saving
MATLAB variables
Array editor GUI for modifying the content of MATLAB
variables
Editor/debugger Text editor and debugger for MATLAB text
files.
MATLAB has Command History Window, Command Window and Work Space
Window. When the MATLAB software is open the following screen opens which has
Command Window on the right side, Work Space Window on the top-left and Command
History Window on the bottom left.
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 36
Fig 3.4.1 Matlab window (Robert Evans, 2009)
Solutions of simple problems can be evaluated using the command window which is
fast and efficient. As the number of commands increases or when there is need to change the
value of any variable, typing at MATLAB prompt becomes tiresome. For this MATLAB
provides simple text file, this files are called script files or M-files. It is called as script file
because MATLAB simply reads from the script found in the file and M-file as these file must
end with the extension ’.m’, for instance, example1.m.
4.6 Script M-Files:
MATLAB not only supports many built-in function such as logarithmic,
trigonometry, complex and exponential but also the user-defined functions which worked as
conveniently as built-in functions. Lookfor command is used to find the functions that are
relevant to the particular application. For example exponential gives a list of functions that
deal with exponent.
lookfor exponential
exp - Exponential.
expint - Exponential integral function.
expm - Matrix exponential.
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 37
expmdemo - Matrix Exponentials
expmdemo1 - Matrix exponential via Pade approximation.
expmdemo2 - Matrix exponential via Taylor series.
Note : help command is used to know the working and utilisation of the function or
command.
The built-in functions are store as image file so there function and computational
details are not readily accessible. The functions that are implemented in M-files thus there
computational details and code can be read.(Williams J.Palm, 2009)
4.7 Arrays:
Operation that involve analysis of single number is called scalars, is the basis of
mathematics. But there exists many occasion where it is needed to perform operation on more
than one number at a time (repeated scalar). To overcome this problem, MATLAB defines
arrays operation.
Arrays are create by starting with left bracket followed by the values separated by
space or commas and then close the array with right bracket.
(source bruce little field )
Cell array and structures are the two data types of MATLAB. These are used to group
dissimilar but related arrays into a single variable. This allow much help in data management
as group of related data can be organised and accessed through a cell array or structure. The
elements of structure can be accessed using the command field and is different from cell
arrays which are accessed using standard array indexing operation.
(source :William j palm)
Example 1: A 2 X 2 cell array K containing the location name, date, air temperature
and the water temperature at three different point in the pond at the same time
K (1, 1) = {‘ Swift pond’};
K(1, 2) = {‘July 28, 1987 ’};
AUTOMATIC FACE DETECTION
Sheffield Hallam University Page 38
K(2, 1) = {‘[30 40 50]’};
K(2, 2) = {[35, 45, 55; 65,75, 85; 95, 15, 25]};
Example 2: A structure array to create database of student containing the information
about the types Student name, student ID, email address and marks. Each type of data is field.