フォルダから画像を順に読み取り処理する方法
Ältere Kommentare anzeigen
画像が複数枚入っているフォルダを読み込み、順に処理を行って保存したいです。
下記のようなコードを書いているのですが、画像が全く表示されません。
エラーメッセージも出ないため、どこが間違っているのか特定できずにいます。
お力を貸していただけないでしょうか。
im_list=dir("フォルダ名");
file_name={im_list.name};
for i=3:size(file_name,1)
I=imread(file_name{1})
imshow(I)
I2=rgb2gray(I);
BW=I2<75;
imshow(BW)
saveas(fig,file_name{1}.pdf)
end
Akzeptierte Antwort
Weitere Antworten (1)
Shunichi Kusano
am 15 Jun. 2022
Bearbeitet: Shunichi Kusano
am 15 Jun. 2022
imageDatastore使うともっと簡単に書けてしまいます。おススメです。
imds = imageDatastore("フォルダ名");
while hasdata(imds)
[I,info] = read(imds);
% 処理を入れる
end
1 Kommentar
Kategorien
Mehr zu イメージ算術 finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!