フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

I have several sub folders where I have images. I want to use imwrite for those images and get all of them in a folder. Thanks.

1 回表示 (過去 30 日間)
Md
Md 2016 年 12 月 15 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have several sub-folders where I have images. I want to use sprintf and imwrite tool for the output of those images and get all of the output images in a folder. Thanks in advance.

回答 (1 件)

Philip G
Philip G 2017 年 2 月 10 日
Hi, I am not sure what exactly you want to do with sprintf and what you mean with "output of the images" but ...
There are functions in the file exchange that list all files in all subdirectories. I use this one for example: subdir
Now you use that very easily like:
files = subdir('c:/images/*.jpg');
With the file list you can make a loop to open+process all the images.
  1 件のコメント
Image Analyst
Image Analyst 2017 年 2 月 10 日
The built-in dir() can also do this with R2016b, as my attached example shows, so there's no need for some third party code.
% Specify the file pattern.
% Get ALL files using the pattern *.PNG
% Note the special file pattern. It has /**/ in it if you want to get files in subfolders of the top level folder.
filePattern = sprintf('%s/**/*.PNG', topLevelFolder);
allFileInfo = dir(filePattern);
Or you can use genpath() like my other attached example if you have older versions of MATLAB.

この質問は閉じられています。

タグ

タグが未入力です。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by