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


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

    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?


1 Answer 1


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.

Additional links:

  • $\begingroup$ thanks for your answer. i voteed it up but you didnt say what can i do with big size of covariance matrix. and how those coeffiecents can be calculated to be compared with coefficients of new picture? every coeficient like ak is for one egenface that is calculated from one picture of certain person. so how may coeficient one new picture can have? $\endgroup$
    – virtouso
    Jul 7, 2016 at 20:06
  • $\begingroup$ You should perform an eigen decomposition with some codes. If the matrix is really huge, there are algorithms to compute only the eigenvectors with the biggest eigenvalues (the most important). Then you compare your vectors using distances, norms, like the Euclidian one, or the Mahalanobis metric. I am adding additional links $\endgroup$ Jul 7, 2016 at 20:15
  • $\begingroup$ i accepted your question but im not really sure. i think coefficeints are eigen values. not really sure $\endgroup$
    – virtouso
    Jul 8, 2016 at 0:44
  • $\begingroup$ 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 $\endgroup$ Jul 8, 2016 at 4:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.