Loading in multiple image files of different sizes
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Alex Flores
am 19 Mai 2017
Beantwortet: Image Analyst
am 19 Mai 2017
Hey guys, I am having issues trying to figure out one of my problems. I am supposed to load in all images from a face image folder. I need to use a for loop. The images can be stored in any way, except I cannot store them into one big matrix because they are all different sizes. Thank you!!
1 Kommentar
Akzeptierte Antwort
KSSV
am 19 Mai 2017
Bearbeitet: KSSV
am 19 Mai 2017
imagefiles = dir('*.jpg') ; % give your extension of images
nfiles = length(imagefiles) ; % total number of images
iwant = cell(nfiles,1) ; % pre-allocation to store images
% loop for each image
for i = 1:nfiles
iwant{i} = imread(imagefiles(i).name) ;
end
0 Kommentare
Weitere Antworten (1)
Image Analyst
am 19 Mai 2017
Simply use imread() in a loop like the FAQ shows:
There is most likely no reason to use a cell array since I doubt there is a definite need to have all the images in memory simultaneously. You'd most likely run into memory problem if you have more than a few dozen. You will most likely process one image at a time so you only need to have one image variable, not a cell array. If you think I'm wrong, tell me why you need all the images in the folder in memory at the very same time (something I rarely rarely , if ever, need to do).
0 Kommentare
Siehe auch
Kategorien
Mehr zu Image Processing Toolbox 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!