Lesson 3/11 and moved eigenfaces folder from 29/9 lesson folder

This commit is contained in:
elvis
2023-11-05 21:28:07 +01:00
parent 17928b1f32
commit 33d89b6bba
183 changed files with 400609 additions and 0 deletions

View File

@ -0,0 +1,18 @@
function eigenfaces_scatter(images, indices);
[w, h, nExpressions, nIndividuals]=size(images);
X=reshape(images,[w*h,nIndividuals*nExpressions]);
avg=mean(X,2);
Xd=bsxfun(@minus,X,avg);
[U,S,V]=svd(Xd,0);
scores=U(:,indices)'*Xd;
%normalize scores and samples
%scores=bsxfun(@rdivide,scores,sqrt(sum(abs(scores).^2)));
if length(indices) == 3
scatter3(scores(1,:),scores(2,:),scores(3,:),50*ones(size(scores(1,:))),kron(1:nIndividuals,ones(1,nExpressions)));
elseif length(indices) == 2
scatter(scores(1,:),scores(2,:),50*ones(size(scores(1,:))),kron(1:nIndividuals,ones(1,nExpressions)));
else
error('wrong indices size');
end