Info

This question is closed. Reopen it to edit or answer.

modify the code to accept jpegs of various sizes

1 view (last 30 days)
pooja
pooja on 15 Apr 2013
Closed: MATLAB Answer Bot on 20 Aug 2021
function out=load_database();
% We load the database the first time we run the program.
persistent loaded;
persistent w;
if(isempty(loaded))
v=zeros(10304,400);
for i=1:40
cd(strcat('s',num2str(i)));
for j=1:10
a=imread(strcat(num2str(j),'.pgm'));
v(:,(i-1)*10+j)=reshape(a,size(a,1)*size(a,2),1);
end
cd ..
end
w=uint8(v); % Convert to unsigned 8 bit numbers to save memory.
end
loaded=1; % Set 'loaded' to aviod loading the database again.
out=w;
sir i want to modify this code in order to make it accept jpeg images of various sizes rather than only accepting pgm images of 11kb...
the error i m facing is..
Error in ==> load_database at 14 v(:,(i)*6+j)=reshape(a,size(a,1)*size(a,2),1);
please help..i do not knw much of matlab...

Answers (1)

Walter Roberson
Walter Roberson on 15 Apr 2013
v(:,(i-1)*10+j)=a(:);
  1 Comment
pooja
pooja on 16 Apr 2013
i am getting error
??? Subscripted assignment dimension mismatch.
Error in ==> load_database at 15 v(:,(i)*6+j)=a(:);

This question is closed.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!