DB=imread('face.bmp');
imshow(DB);
m=28*2;n=23*2;
figure;
for k=1:10
[A, y, B, testy]=read_faceDB();
% A: 40x42 or 40x?
% y:  1x40
% B: 22x42 or 22x?
% testy : 1x22
% priciple component analysis
[X,W]=pca(A,40);
B1=B-ones(size(B,1),1)*mean(A);
BB=B1*W';
% Nearest Classification
for i=1:size(BB,1)
    x=BB(i,:);
    c(i)=Nearest_C(X,y,x);
end
hit(k)=sum(c==testy)
rate(k)=hit(k)/size(testy,2)
end
hist(rate)

