[英]MATLAB: How to import a batch of image iteratively in a folder and export processed image iteratively?
這是我需要做的:
所有圖像(其中40,000張)都在一個文件下,並且都命名為“ roof _ *。jpg”;
for i=1:40000
Step One: import and image from the file directory
"/Users/gaochenying1/Documents/MATLAB/roof_images_copy"
Step Two: process it (that part I can do);
Step Three: export processed image into the same file but named
"r_roof_*.jpg";
end
我試過了
filelist = dir([fileparts('/Users/gaochenying1/Documents/MATLAB/roof_images_copy') filesep 'roof_*.jpg']);
fileNames = {filelist.name}';
它根本沒有用!
folder = 'C:/Users/gaochenying1/Documents/MATLAB/roof_images_copy';
files = dir(fullfile(folder,'roof_*.jpg'));
for i = 1:length(files)
fn_i = files(i).name;
im_in = imread(fullfile(folder,fn_i));
im_out = processingfunction(im_in);
imwrite(im_out,fullfile(folder,sprintf('r_%s',fn_i)));
end
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.