フォルダから画像を順に読み取り処理する方法
Afficher commentaires plus anciens
画像が複数枚入っているフォルダを読み込み、順に処理を行って保存したいです。
下記のようなコードを書いているのですが、画像が全く表示されません。
エラーメッセージも出ないため、どこが間違っているのか特定できずにいます。
お力を貸していただけないでしょうか。
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
Réponse acceptée
Plus de réponses (1)
Shunichi Kusano
le 15 Juin 2022
Modifié(e) : Shunichi Kusano
le 15 Juin 2022
imageDatastore使うともっと簡単に書けてしまいます。おススメです。
imds = imageDatastore("フォルダ名");
while hasdata(imds)
[I,info] = read(imds);
% 処理を入れる
end
1 commentaire
Catégories
En savoir plus sur イメージ算術 dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!