[Numpy-discussion] PCA on set of face images
devnew@gmai...
devnew@gmai...
Fri Feb 29 13:15:00 CST 2008
hi guys
I have a set of face images with which i want to do face recognition
using Petland's PCA method.I gathered these steps from their docs
1.represent matrix of face images data
2.find the adjusted matrix by substracting the mean face
3.calculate covariance matrix (cov=A* A_transpose) where A is from
step2
4.find eigenvectors and select those with highest eigenvalues
5.calculate facespace=eigenvectors*A
when it comes to implementation i have doubts as to how i should
represent the matrix of face images?
using PIL image.getdata() i can make an array of each greyscale image.
Should the matrix be like each row contains an array representing an
image? That will make a matrix with rows=numimages and
columns=numpixels
cavariancematrix =A *A_transpose will create a square matrix of
shape(numimages,numimages)
Using numpy.linalg.eigh(covariancematrix) will give eigenvectors of
same shape as the covariance matrix.
I would like to know if this is the correct way to do this..I have no
big expertise in linear algebra so i would be grateful if someone can
confirm the right way of doing this
RoyG
More information about the Numpy-discussion
mailing list