문제

I am doing face recognition using PCA and SVM. My training set has an array of 400 images on which i have performed PCA and mapped the data into the eigenspace. Now for testing i have only a single image whose principal components i need to extract to match with the previously extracted features. But any algorithm of PCA i use or even the inbuilt command (princomp) i am getting dimension error. Cause PCA requires forming the eigenspace and projecting data onto this space, how do i form the eigenspace for a single image?

도움이 되었습니까?

해결책

You should use the same eigenspace obtained with the training data.

Here you have a tutorial that explains it very well. These are the main steps:

Training:

% step: 1: find the mean image
mean_face = mean(images, 2);
% step 3 : calculate the eigenvectors and eigenvalues
[evectors, score, evalues] = princomp(images');

Testing:

% calculate the feture vector
feature_vec = evectors' * (input_image(:) - mean_face);

As you can see evectorsand mean_face were coputed during the training stage.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top