resizing all images in a folder
Ältere Kommentare anzeigen
I am able to get matlab to resize and save an individual image, but I'm wondering how I can get it to do this for all images in a folder without having to type in the names one by one. The names of the saved & original images must stay the same if that makes any difference. Could I load the images into an array and then have it loop through each image? Sorry if this is a dumb question!
Akzeptierte Antwort
Weitere Antworten (2)
Image Analyst
am 28 Sep. 2015
0 Stimmen
See the FAQ for code to do this:
Put your calls to imread(), imresize() and imwrite() inside the loop.
1 Kommentar
Victoria Lawlor
am 28 Sep. 2015
anis martina
am 26 Mär. 2024
Bearbeitet: anis martina
am 26 Mär. 2024
0 Stimmen
resize multiple image using in matlab image import in file code
1 Kommentar
Image Analyst
am 26 Mär. 2024
See the attached demo. It computes the average RGB image. If the second and subsequent images are of a different size than the first image, it will resize them to match the first image. You can easily not sum the images (because you don't need the mean) and add a call to imwrite to save them to disk, just create the full file name using fullfile and put them in different folder just in case you have some kind of mistake that you don't destroy the original.
Kategorien
Mehr zu Convert Image Type finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!