I'm reading a series of .png images into matlab from a folder on my computer using the code below:
datapath = dirname;
i = 1;
myFolder = dirname;
if ~isdir(myFolder)
errorMessage = sprintf('Error: The following folder does not exist:\n%s', myFolder);
uiwait(warndlg(errorMessage));
return;
end
filePattern = fullfile(myFolder, '*.png');
pngFiles = dir(filePattern);
for k = 1:length(pngFiles)
baseFileName = pngFiles(k).name;
fullFileName = fullfile(myFolder, baseFileName);
imageArray{i} = double(imread(fullFileName))/255;
%imshow(imageArray{i});
i = i+1;
end
Each png I'm reading is 1024x800. However, when I hover over imageArray{i} when using the debugger I'm told that the dimensions of the image are 800x1024x3! Firstly, how did the rows and columns get mixed up? Secondly, why is my 2D image being given an extra dimension? The odd thing is that when call imshow on imageArray{i} it displays a perfectly normal looking image. What is going one here?
Thanks!