csci5521/assignments/hwk02/Eigenfaces.m
2023-10-21 23:32:00 -05:00

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