resizing all images in a folder
显示 更早的评论
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!
采纳的回答
更多回答(2 个)
Image Analyst
2015-9-28
0 个投票
See the FAQ for code to do this:
Put your calls to imread(), imresize() and imwrite() inside the loop.
anis martina
2024-3-26
编辑:anis martina
2024-3-26
0 个投票
resize multiple image using in matlab image import in file code
1 个评论
Image Analyst
2024-3-26
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Convert Image Type 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!