How to read the images serially from imageDataStore
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
TARUN
am 27 Feb. 2025
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 Kommentare
Siehe auch
Kategorien
Mehr zu Deep Learning Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!