problem using pca eigenfaces

5 views (last 30 days)
Newman
Newman on 20 Jul 2016
Hello I am doing a face recognition using pca and eigenfaces using a neural network.
this is my code
here m is a 10344x360 matrix columns are images converted in to vectors (360 images) out of 400 images dataset(s1 s10... s40 s5 ss7 s8 s9)
mean_face = mean(m, 2);
shifted_images = m - repmat(mean_face, 1, size(m,2));
% calculate the ordered eigenvectors and eigenvalues
[evectors, score, evalues] = pca(m);
% project the images into the subspace to generate the feature vectors
featurestraineigen = (evectors * shifted_images')';
The problem is when I am writing this piece of code to see the ghost images or eigenfaces its shwowing somewhat differnt images / images from differnt class
code
imshow(uint8(reshape(featurestraineigen(:,4),112,92)));
This should show mw a ghost image of no 4 image in the the first class s1(each class has different image).But its showing something else (some other class person i think).Is there any problem in my last line? featurestraineigen?
And moreover kindly tell me how to crate the testing set for this how should I convert a new input image from the testing set for multi class classification using neural net?

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!