check if the picture exist within the database
1 回表示 (過去 30 日間)
古いコメントを表示
hello I have read a database of images in matlab, I want to check if all the pictures exist before i run the program, what is the command to check ?
2 件のコメント
Konstantinos Sofos
2015 年 3 月 19 日
What do you mean by read? You have a list of all the names or you have read them by imread?
回答 (1 件)
Konstantinos Sofos
2015 年 3 月 19 日
編集済み: Konstantinos Sofos
2015 年 3 月 19 日
Hi,
you could use an exception catcher
Directory = fullfile ('C:','Users','Documents','MATLAB','image');
Images = dir(fullfile(Directory,'*.jpg'));
Names = {Images.name}';
for k=1: numel(Names)
try
I=imread(fullfile(Directory,Names{k}));
catch
error( ...)
end
end
Regards,
参考
カテゴリ
Help Center および File Exchange で File Operations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!