Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

error trying to generate eigenvalues of gray scale images - final project for grad school stalled - please help

13 views
Skip to first unread message

Julie

unread,
May 8, 2012, 4:22:06 PM5/8/12
to
I am trying to find run a Principal Component Analysis on a set of 4 grey scale images, all the same size initially, 100 x 100, contained in a matrix A.

I am trying to do eigenfaces and to obtain the eigenvalues.

When I run the following mfile I get the follow message:

Can anyone please help?

------
Error Message:

Error using bsxfun
Mixed integer class inputs are not supported.

Error in princomp (line 64)
x0 = bsxfun(@minus,x,mean(x,1));

Error in face1 (line 36)
[COEFF, SCORE, latent] = princomp(A);

MFile:

I1 = imread('james1.tif');
k=1;
for i=1:100
for j=1:100
dat1(k) = I(i,j); k=k+1;
end
end

I2 = imread('julianne1.tif');
k=1;
for i=1:100
for j=1:100
dat2(k) = I(i,j); k=k+1;
end
end


I3 = imread('nick1.tif');
k=1;
for i=1:100
for j=1:100
dat3(k) = I(i,j); k=k+1;
end
end

I4 = imread('Nick2.tif');
k=1;
for i=1:100
for j=1:100
dat4(k) = I(i,j); k=k+1;
end
end

A = [dat1; dat2; dat3; dat4];

[COEFF, SCORE, latent] = princomp(A);

---

tried pcacov(A) as well. Tried converting data to doubles.

Bastien

unread,
May 22, 2013, 4:34:17 AM5/22/13
to
"Julie" wrote in message <jobv9e$onu$1...@newscl01ah.mathworks.com>...
Hello,
I have the save problem, trying to run a PCA on 446 168x168 images.
---
F_bas=fopen('08_BA_M_FACEAntbasal.IMG'); % File opening, data lecture
A_bas=fread(F_bas,128*128*nb_total,'*uint16');
B_bas=reshape(A_bas,128,128,nb_total);
fclose(F_bas);
C_bas=B_bas(:,:,nb_skipped:end); % Because I have to skip some irrelevant pictures
D_bas=reshape(C_bas,128*128,nb_total-nb_skipped+1);
[X_coef X_sco]= princomp(D_bas); %PCA where D_bas is a 16.384*446 matrix of uint16
---

Are 16 bit unsigned integers incompatible with bsxfun or is the problem different, maybe because of my matrix' size?
Thanks
0 new messages