To perform face recognition, i have a train database with some images. The images in train database need to be pre-processed before they are used for comparison with the test image, which is the input image.
This is what i have done :
T = []; for i = 1 : Train_Number str = int2str(i); str = strcat('\',str,'.jpg'); str = strcat(TrainDatabasePath,str); img = imread(str); img = rgb2gray(img); img = imresize(img, [200 180]); [irow icol] = size(img); temp = reshape(img',irow*icol,1); % temp = reshape(permute(double(img), [2,1,3]), irow*icol, 1);
T = [T temp]; % 'T' grows after each turn
end
This works fine when the train database contains only rgb images. But for grayscale images, it gives error related to dimensions.
How can i make it work for both rgb and grayscale ??
Best Answer