18 lines
No EOL
414 B
Matlab
18 lines
No EOL
414 B
Matlab
% implements Eigenfaces, returns nothings but displays a plot of the first
|
|
% 5 eigenvectors
|
|
function [] = Eigenfaces(training_data, test_data)
|
|
|
|
% stack data
|
|
data = vertcat(training_data, test_data);
|
|
|
|
% perform PCA
|
|
coeff = pca(data);
|
|
|
|
% show the first 5 eigenvectors (see homework for example)
|
|
for i = 1:5
|
|
subplot(3,2,i)
|
|
imagesc(reshape(coeff(:,i),32,30)');
|
|
end
|
|
% pause;
|
|
|
|
end % Function end |