How do I read in images of different dimensions into an array in matlab

1 Ansicht (letzte 30 Tage)
Taiwo
Taiwo am 6 Aug. 2012
Goodmorning somebody there, I want to read in images of different dimensions into an array but am having this error
??? Subscripted assignment dimension mismatch.
Error in ==> loadExample at 10
myArray(:,:,:,p) = imread(fullfile(H, myFile{p}));
my code is as below:
H = fullfile('C:\Users','Adigun','My Documents','One_Thousand');
myFolder = dir(fullfile(H,'0*.jpg'));
myFile = {myFolder.name};
numImage = numel(myFile);
I = imread(fullfile(H, myFile{1}));
%figure(7), imshow(I);
myArray = zeros([size(I) numImage], class(I));
%myarray(:,:,1) = I;
for p = 1:numImage
myArray(:,:,:,p) = imread(fullfile(H, myFile{p}));
end
figure(8), imshow(myArray(:,:,:,2));

Antworten (1)

Andrei Bobrov
Andrei Bobrov am 6 Aug. 2012
try this is code:
myArray = cell(1,numImage);
for p = 1:numImage
myArray{p} = imread(fullfile(H, myFile{p}));
end

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by