Eigenface Tutorial
Keywords: Matlab, Face Recognition,
Eigenfaces, Computer vision
This picture represents the set of images used to
create our eigen space for face recognition. The goal of this tutorial is to
apply the eigenface approach to recognize someone's face. The overall problem is
to be able to accurately recognize a person's identity and take some action
based on the outcome of the recognition process. Recognize a person's identity
is important mainly for security reason, but it could also be used to
obtain quick access to medical, criminal, or any type of records. Solving this
problem is important because it could allow personnel to take preventive action
action, provide better service  in the case of a doctors appointment, or allow
a person access to a secure area. This tutorial will shows you how to build a
face recognition program using Matlab.
Motivation and Audience
This tutorial has been
developed to get people interest on computer vision and face recognition;
in addition to give you some guidance on how to approach the problem. The
reader should have the following background and interests:

Moderate Matlab knowledge
 Being familiar with Linear Algebra
concepts

Desire to learn about face recognition using
Matlab

In addition, would like to learn more about computer vision
The rest of the tutorial is presented as follows:
Parts List and Sources
USbased vendors to obtain material to complete this tutorial include
Mathworks
To complete this tutorial, you'll need the following items
Software  VENDOR 
Version  PRICE 
QTY 
Matlab 
Mathworks 
6.1  $500 
1 
Construction
This section gives stepbystep
instructions along with photos and formulas on how to recognize faces and
implemented into Matlab. All the necessary files to complete this tutorial
would be provided.
Steps

The first step is to obtain a set S with M face images.
In our example M = 25 as shown at the beginning of the tutorial. Each image
is transformed into a vector of size N and placed into the set.

After you have obtained your set, you will obtain the
mean image Ψ

Then you will find the
difference Φ between the input image and the mean image

Next we seek a set of M orthonormal vectors,
u_{n},
which best describes the distribution of the data. The k^{th}
vector, u_{k}, is chosen such that
is a maximum,
subject to
Note:
u_{k}
and λ_{k
}are the eigenvectors and
eigenvalues of the covariance matrix C

We obtain the covariance matrix C in the
following manner

A^{T}

Once we have found the eigenvectors, v_{l},
u_{l}
These are the eigenfaces of our set of original images
Recognition Procedure
1. A new face is transformed into its eigenface components. First we
compare our input image with our mean image and multiply their difference
with each eigenvector of the L matrix. Each value would represent a weight
and would be saved on a vector Ω.
2. We now determine which face class provides the best description for the
input image. This is done by minimizing the Euclidean distance
3. The input face is consider to belong to a class if
ε_{k }is bellow an established
threshold θ_{ε}. Then the face
image is considered to be a known face. If the difference is above the
given threshold, but bellow a second threshold, the image can be
determined as a unknown face. If the input image is above these two
thresholds, the image is determined NOT to be a face.
4. If the image is found to be an unknown
face, you could decide whether or not you want to add the image to your
training set for future recognitions. You would have to repeat steps 1
trough 7 to incorporate this new face image.
See Results
The source code face recognition using Matlab is provided below:
To be compiled with Matlab Editor/Debugger
Note: download the
Face Recognition Kit rather than cutting and pasting from below.
Use WinZip to unzip the
files. All the necessary files are included.
Example of Face.m script for face recognition using Matlab:
Click here to go to the code
Download Face Recognition Kit
If you follow the steps on the tutorial you will obtain the following results. These results are different
from the ones shown above, since the images have not been normalized or filtered.
Code Description
This algorithm works in the following manner:
First, it obtains several images from the training set
(figure 1). The code was been tested using bmp and jpg images. After
loading these images, we find the mean face and perform several calculation
(refer to code and tutorial). Next, we ask for the name of an image we want to
recognize (note: the image must have the same size as the training images). The
default path of your input image is your desktop. You could change it by
modifying the code on line 159. We then
project the input image into the eigenspace, and based on the difference
from the eigenfaces we make a decision.
Please look at results of our algorithm and
Adam's algorithm.
Final Words
Although our algorithm works, it is necessary to normalize the images
and use some filtering techniques to obtain better results. We encourage
you to modify our code to obtain better results. The following links will
provide you with more examples and will give you a better idea about face
recognition.
Useful links
Click here
to email me