how i can import imagedatstore contains subfolder of image?
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Image Analyst
2020-4-12
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 GigE Vision Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!