簡體   English   中英

MATLAB:如何以迭代方式在文件夾中導入一批圖像,並以迭代方式導出經過處理的圖像?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM