Face-Recognition Home

 

5.2  Finding EigenFaces

 

(1) Collect a bunch [say 15] of sample face images . Dimensions of all images should be same . An image can be stored in an array of  n*n  dimensions [] which can be considered as a image vector.

 

Where M is the number of images .

(2) Find the average image of bunch of images .

(3) Find the deviated [avg - img1 , avg - img2, ......... , avg - img.n] images .

(4) Calculate the covariance matrix . 

             

where        

                         

But the problem with this approach is that we may not be able to complete this operation for a bunch of images because covariance matrix will be very huge. For Example Covariance matrix   ,where dimension of a image = 256 * 256, will consist of [256 * 256] rows and same numbers of columns. So its very hard or may be practically impossible to store that matrix and finding that matrix will require considerable computational requirements.

So for solving this problem we can first compute the matrix L.  

     

And then find the eigen vectors [v] related to it

Eigen Vectors for Covariance matrix C can be found by

where

are the Eigen Vectors for C.

 

(5) Using these eigen vectors , we  can construct eigen faces . But we are interested in the eigen vectors with high eigen values . So eigen vectors with less than a threshold eigen value can be dropped .So we will keep only those images which correspond to the highest eigen values. This set of images is called as face space. For doing that in java , we have used colt algebra package. These are the steps involved in the implementation -->

i) Find  [from 4]

Convert it in to a DoubleDenseMatrix2D by using colt matrix class.

ii) Find the eigen vector associated with that by using class  :-

cern.colt.matrix.linalg.EigenvalueDecomposition 

This will be a M by M [M = number of training images] matrix.

iii) By Multiplying that with 'A' [Difference image matrix] we'll be able to get the actual eigenvector matrix [U] of covariance of 'A'. It will be of M by X [Where X is the total number of pixels in a image].