MATLAB: Is it possible to adjust the codes such a way that it’l read all sizes of images

face recognition systemImage Processing Toolbox

is it possible to adjust the codes such a way that it'l read all sizes of images currently its taking only 11kb
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;

Best Answer

You need to either make v a cell array, so that each element would be an image of a different size, or you need to call imresize before you stuff it into a column of v (if v is to remain just a regular numerical array).
Related Question