how i can import imagedatstore contains subfolder of image?
4 views (last 30 days)
Show older comments
hello every one
i want to load an imagedatastore that contains subfolder of image. I have used this programme but it doesn't work, where the database is the folder and it contains 5 subfolders
%% Load the dataset
rootFolder = 'database.mp;
imds = imageDatastore('database', 'IncludeSubfolders',1 ,'LabelSource', 'foldernames');
% after that i want to read the first 10 image of each subfolder i haev use this programme
for i=1:10
img = readimage(rootFolder, i);
end
also this code dosn't work how can i do that
0 Comments
Accepted Answer
Image Analyst
on 12 Apr 2020
Try this:
%% Load the dataset
% rootFolder = 'database.mp';
rootFolder = 'D:\OneDrive\Not Shared\Matlab\work\Tests'; % Wherever. Change to your computer...
imds = imageDatastore(rootFolder, 'IncludeSubfolders',1 ,'LabelSource', 'foldernames');
% after that i want to read the first 10 image of each subfolder i haev use this programme
for k = 1 : 10
thisFullFileName = imds.Files{k};
fprintf('Reading in %s.\n', thisFullFileName);
thisImage = readimage(imds, k);
imshow(thisImage);
drawnow;
end
0 Comments
More Answers (0)
See Also
Categories
Find more on GigE Vision Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!