load FacesBW % This loads the data, H, which is (1204 x 1076) x 15. We'll only use 4 vectors. idx=[6 3 15 1]; % Which faces do we want to use? H=H(:,idx); [Q,R]=qr(H,0); % The columns of Q form the orthonormal basis for our face space. m=1204; n=1076; % NOTES: % To see the negative of any of the images, replace Q(:,i) by -Q(:,i) % % To see the original vector, replace Q(:,i) by H(:,i) % figure(1) imagesc(reshape(Q(:,1),m,n)); colormap(gray); axis equal; axis off; figure(2) imagesc(reshape(Q(:,2),m,n)); colormap(gray); axis equal; axis off; figure(3) imagesc(reshape(Q(:,3),m,n)); colormap(gray); axis equal; axis off; figure(4) imagesc(reshape(Q(:,4),m,n)); colormap(gray); axis equal; axis off;