My code is to getting images from file and and converting images to vector form.
directory = 'C:\Users\Guest\Desktop\FaceRecog\TrainingSet\';
images = dir(strcat(directory,'*.bmp'));
lengthOfFile = length(images);
[m,n] = size(imread(strcat(directory,images(1).name)));
vectorDim = m*n;
Subjects = zeros(vectorDim,lengthOfFile);
for i=1:lengthOfFile
imagePath = strcat(directory,images(i).name);
Temp = reshape(imread(imagePath),[],1);
Subjects(:,i)=Temp;
end
DblInxSubj = im2double(Subjects);
Matlab Variables area shows "DblInxSubj" Matrix 77760*40 in size and double type logically correct(and respect to my calculations,too) but when i print a part of this matrix DblInxSubj(1,:) MATLAB printed numbers in a range 0-255 not btw in 0-1.
Finally,im2Double() is not working to convert larger dimensions array ?
for i=1:lengthOfFile
imagePath = strcat(directory,images(i).name);
Temp = reshape(imread(imagePath),[],1);
Subjects(:,i)=Temp;
end
When i changed the statement Subjects(:,i)=Temp; as Subjects(:,i)=im2Double(Temp); i get correct matrix's indexes values in a range 0-1.I don't understand where the difference exactly?