# Face Recognition: Simplistic Explanation on PCA Eigenface Algorithm

I m working on a project that I have to use eigenface but I have some uncertainty and I dont know how to deal with it. There are some tutorials about it on internet but I can't understand what exactly they mean.

This is what i know:

• First of all you have to make image matrix to a vector. So you have to attach next rows one after another to the first row.

• Then if we have many images of one person, we add up every certain index of all images and divide it count of those images. so

mean[1]= image1[1]+image2[1]+..../images count

Questions:

1. After that we have make deviation image. First question is we do it for every row image? So:

divImage1[1]=image1[1]-mean[1];
So we have to make covariance matrix of deviation image; so:
cov(image1)=cov( transpose(devImage1)* devImage);

2. Next question is: it's a big matrix.

• How should I deal with it? I read that you can just calculate subImage of it. Or as it's a symmetric matrix, you just have to calculate befor diagonal elements. but im not sure its the main idea

• So I have to calculate eigenvector of this matrix. And this is our eigenface. So we have one eigenface for every image of one person?

3. Next question is: I don't know when they give us a new image how we should work with these eigenfaces to recognize that is some one?

The step-to-step explanation in Eigenface seems quite clear to me.

A covariance matrix is like an high-dimensional extension of the variance, which is computed by removing the average from your only sample.

1. Yes, you remove the average face ($\operatorname{AF}$ from all images, but keep it preciously. Your cov(image1) definition seems weird to me, but suppose you have it.

2. The eigenvectors of the big matrix are eigenfaces ($\operatorname{EF}$), put in vector form, you can reshape them to image form. Imagine that as a common trait shared by several persons in your image base.

At this stage, each image $I_k$ can be approximated by a linear combination of $\operatorname{EF}$s: $$I_k = \operatorname{AF}+a_k \operatorname{EF}_1+b_k \operatorname{EF}_2+c_k \operatorname{EF}_3\ldots\,.$$ The idea is that the different pictures of the same person will have almost the same $a_k,b_k,c_k$, because their share the same traits. But a different person would have quite different coefficients. So comparing the vectors of coefficients may help distinguish different persons. In your case:

1. You have computed eigenfaces. A new picture arrives. If you compute its coefficients on the $\operatorname{EF}$s (called a projection), if they are close to the coefficients of another person, in fact the closest, then, maybe, the new picture is a picture of the guy.

• I am not really sure about your familiarity with eigenvectors. For each eigenvector, you have one eigenvalue (simply put). For each vector $v$, you have $n$ coefficients when this vector is expressed in the eigenvector orthogonal basis. They are not eigenvalues in general, unless $v$ is indeed proportional to one of the eigenvector – Laurent Duval Jul 8 '16 at 4:27