|
On May 6, 8:48=A0pm, "Bo Dai" <db...@163.com> wrote:
> Hi, All,
>
> I used the codes inhttp://www.cs.ait.ac.th/~mdaileyto make
> pca eigfaces. And the train images are att face database.
>
> [images,w,h]=3Dload_images('AttFace.dat');
> [Vecs,Vals,Psi] =3D pc_evectors(images,30);
> Proj =3D Vecs' * images; =A0
>
> Then I use one of the train image(s1\1.pgm) to calculate the
> distance between the eigvectors as follows:
>
> nstr=3D'att_faces\s1\1.pgm';
> f=3Dimread(nstr);
> f2=3Dreshape(f,m,1);
>
> Vecs=3Ddouble(Vecs);
> f2=3Ddouble(f2);
> Psi=3Ddouble(Psi);
> %get the weights wk of the eigfaces to the new image
> npro=3DVecs'*(f2-Psi)
>
> %m1 is the size of the image, m2 is the number of the train
> %images
> [m1,m2]=3Dsize(Proj)
>
> for i=3D1:m2
>
> =A0 =A0 dist(i)=3D norm(Proj(:,i)-npro(:));
>
> end;
> [dist_min2,index2]=3Dmin(dist)
>
> If it's right, index2 should be 1, but the result is 22.
>
> I don't know why.
> Can you help me ?
I didn't read your code. In general, however, PCA is not recommended
for classification. Search the archives
using
greg-heath thin disks
Hope this helps.
Greg
|