Dear Readers: Welcome to The Engineering Projects

## Sunday, 1 May 2011

### Face Access - Mathematical Calculation

Page Views:

When one thinks of face recognition, one immediately thinks of finding features of a face: eyes, nose, ears, cheek bones. But who's to say that these are the most distinguishing characteristics of a face, and that they are the best features by which a face should be described? And what if these features are correlated? Instead of hard-coding features for detection, we decided to find the orthogonal features that most optimally describe our large training set by using Principal Component Analysis. This creates an orthogonal basis of principal components for our training set. The basis vectors are known as eigenfaces, and can be thought of as characteristic features of a face. All new faces will be described as a linear combination of these eigenfaces. This is equivalent to projecting the new face onto the subspace spanned by our eigenfaces. By using only the eigenfaces with the highest eigenvalues, we ensure that our projection maintains the most face-like energy from the image. This method was proposed by M. Turk and A. Pentland in 1991.
The system is divided into three different processes: Training, Enrolling, Recognizing.

#### Training

The training portion of the system consists of creating the eigenfaces based on a set of training faces. The goal was to create as many eigenfaces as possible and keep the M eigenfaces that had the highest eigenvalues.
Given N training images, create a matrix where each column is a face vector of length 176 * 143 = 25168.

We used a total of N=40 training faces to create the eigenfaces. Below are the raw images captured (before any processing) of some of our volunteers; not all of these faces were used to create the eigenfaces.

To create the eigenfaces we use the following algorithm:
1. Normalize each face
• Calculate the mean and standard deviation of each face. This is like brightness and contrast.
• Normalize each image so that each face is closer to some desired mean and standard deviation
• Calculate the mean image based on the M normalized images.
• Calculate the difference matrix using the new mean face.
1. Find the eigenvectors of D * D'. However, this is too large of a matrix so it can not be done directly.
• Find the eigenvectors v of D' * D.
• Multiply the resulting eigenvector by D to get the eigenvectors of D * D'.
1. Take the eigenfaces that correspond to the M eigenvectors with the highest value.
Below are 28 of the 30 eigenfaces we created. For enrolling purposes we use only the top 25 eigenfaces.

#### Enrolling

The enrollment process consists of creating a user "template" for comparison when he tries to log in again later. The template is an M-length vector (M is the number of eigenfaces used to create the face space) that represents the correlation of the user's face with each eigenface. We use M = 25.
To create a user template from the 176x143 face image, we use the following algorithm:
• Follow the same steps as above to normalize the new face image to the desired mean and standard deviation used in the eigenface calculation.
• Create the "difference" face by subtracting the average face from the normalized new face
• Dot the "difference" face with each eigenface. The value of the ith dot product is the ith element of the template. T is the template, F is the difference face, and E is the eigenface.

#### Logging In

When a user attempts to log in, a new face template is created from the newly captured image as described above. This template is then compared with every other saved template. The measure of correlation we use is the cosine of the angle between the different templates. If the correlation between two templates is above the desired threshold then a "match" has been found. After testing, we decided to use 0.85 as a threshold. This was small enough to reduce false negatives while high enough to eliminate false positives.
To log in a user with their new 176x143 image, we used the following algorithm:
• Follow the same steps as the enrollment process to create a new template, T_new
• Calculate the correlation of T_new with all of the stored templates to find the number of matches.
Below is a visual example of the projection of a face onto our eigenface space. The image on the left is the image captured by the C3088 camera, and the image on the right is the reconstructed linear combination of eigenfaces defined by the user's template. This person was not used to create the eigenfaces. We never actually create this reconstructed image on the microcontroller. We only store the template.

If you don't want to get yourself into Serious Technical Trouble while doing your programming OR technical projects then just sit back and relax and let us do the Job for you at a fairly reasonable cost. Submit your project details by Clicking Here »

I am Syed Zain Nasir, the founder of The Engineering Projects (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry.

 Follow @theenggprojects In 61 people's circles

# Subscribe To Get FREE Tutorials!

#### Confused? Feel free to ask

Your feedback is always appreciated. I will try to reply to your queries as soon as time allows.
Note:-
Please do not spam Spam comments will be deleted immediately upon my review.

Regards,