Is there a function that returns the total number of images in an imageDatastore?
For example, if I load images from a directory and wanted to know the total number of images and index each image, how can I do that?
imds = imageDatastore(ipath, 'FileExtensions', {'.jpg', '.tif', '.png'}); i = 1;while hasdata(imds) [img, imgInfo] = readImage(imds, i); fprintf('process %s \n', imgInfo.('Filename')); i = i+1;end
The above code shows out of index error ( i exceeds number of files ).
and is this the fastest way to read images from a location?
Best Answer