How to apply a function on all images in ImageDatastore ?
9 ビュー (過去 30 日間)
古いコメントを表示
I am using Imagedatastore function for classification problem but now I need to apply an function to all images in imageDatastore
YPred =classify(net,TestImages);
0 件のコメント
採用された回答
Jeremy Hughes
2021 年 2 月 5 日
編集済み: Jeremy Hughes
2021 年 2 月 5 日
I think this is what you want.
imds = imageDatastore(files,...)
tds = transform(imds,@(img)classify(net,img));
YPred = readall(tds);
3 件のコメント
Jeremy Hughes
2021 年 2 月 7 日
You can do multiple transforms,
imds = imageDatastore(files,...);
tds = transform(imds,@(img) ~imbinarize(img));
tds = transform(tds,@(img) classify(net,img));
YPred = readall(tds);
Based on what you wrote, I want to make sure you understand that this:
@(imd) ~imbinarize(imd)
doesn't take in a datastore as an input, it takes the image data, one-by-one, and then calls imbinarize on each result.
It works as if you called
imds = imageDatastore(files);
while hasdata(imds)
img = read(imds); % read an image from the datastore
img = ~imbinarize(img);
Ypred(end+1) = classify(net,img);
end
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Image Data Workflows についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!