Can sumone help me solve this Matlab error ??

Status
Not open for further replies.

Michaelhk1987

Newbie level 1
Joined
Apr 15, 2011
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,296
This my code,

nTrainPosData = 60;
nTrainNegData = 80;
nLevels = 10;
W = 19;
H = 19;

posImageDir = 'face2';
negImageDir = 'nonface';

PTrainData = zeros(W, H, nTrainPosData);
NTrainData = zeros(W, H, nTrainNegData);

pfiles = dir(posImageDir );
nfiles = dir(negImageDir );

aa = 1:length(pfiles); a = randperm(length(aa)); trainPosPerm = aa(a(1:nTrainPosData));
ab = 1:length(nfiles); b = randperm(length(ab)); trainNegPerm = ab(b(1:nTrainNegData));

testPosPerm = setdiff(1:length(pfiles), trainPosPerm);
testNegPerm = setdiff(1:length(nfiles), trainNegPerm);

PTestData = zeros(W, H, length(testPosPerm));
NTestData = zeros(W, H, length(testNegPerm));

% read train data
for i=1:size(PTrainData,3)
PTrainData,:,i) = imread( [ pfiles(trainPosPerm(i)).name]);

end
for i=1:size(NTrainData,3)
NTrainData,:,i) = imread( [nfiles(trainNegPerm(i)).name]);

end

% read test data
for i=1:size(PTestData,3)
PTestData,:,i) = imread([posImageDir pfiles(testPosPerm(i)).name]);
end
for i=1:size(NTestData,3)
NTestData,:,i) = imread([negImageDir nfiles(testNegPerm(i)).name]);

end

% find classifier parameters
Cparams = Train(PTrainData, NTrainData, PTestData, NTestData, nLevels);

save('C:\Documents and Settings\user\Desktop\lmf.mat', 'Cparams');

>> this the error is :
??? Error using ==> imread at 361
File "36.jpg" does not exist.

Error in ==> SimpleTrain1 at 28
PTrainData,:,i) = imread( [ pfiles(trainPosPerm(i)).name]);
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…