How to read the images serially from imageDataStore
3 ビュー (過去 30 日間)
古いコメントを表示
In the example of Train Deep Learning Network to Classify New Images mentioned in MATLAB Help Documentation, they have mentioned the following
idx = randperm(numel(imdsValidation.Files),4);
to read the any/random four images. How can I read all files serially, present in "imdsValidation.Files".
0 件のコメント
回答 (1 件)
TARUN
2025 年 2 月 27 日
I understand you are interested in reading all the images sequentially from an imageDatastore.
You can achieve this by using a for loop, as demonstrated in the example below:
filePaths = imdsValidation.Files;
numFiles = numel(filePaths);
for i = 1:numel(imdsValidation.Files)
% Get the path of the i-th image
imgPath = imdsValidation.Files{i};
img = imread(imgPath);
imshow(img); % display the image
title(['Image ' num2str(i)]);
This script will iterate over each file in imdsValidation.Files, read the image using imread, and display it using imshow.
You can refer to the following MathWorks documentation for more information:
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Deep Learning Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!