how i extract features from my image datastore?

5 ビュー (過去 30 日間)
youb mr
youb mr 2020 年 4 月 13 日
回答済み: Rahul 2024 年 12 月 4 日
hello everyone
i'm trying to extract logical binary pattern from image datastore
this my code
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
how i can used extractLBPFeatures to extract feature for each image from my imagedatastore

回答 (1 件)

Rahul
Rahul 2024 年 12 月 4 日
As per the code shared by you, in order to 'extractLPBFeatures' from each image from your 'imageDatastore', the following additions can be added to your existing code:
  • Since the function 'extractLPBFeatures' expects an image, it can be used directly in your loop after reading the image from the 'imagedatastore' using 'readImage' function.
  • The extracted features can be stored in a cell array.
Hence your code can be adjusted in the following way:
imds = imageDatastore(rootFolder, 'IncludeSubfolders', true, 'LabelSource', 'foldernames');
% Initialize a cell array to store LBP features for each image
lbpFeaturesCell = cell(numel(imds.Files), 1); % Addition 1
for k = 1:numel(imds.Files)
thisFullFileName = imds.Files{k};
fprintf('Reading in %s.\n', thisFullFileName);
thisImage = readimage(imds, k);
imshow(thisImage);
drawnow;
% Extract and store LBP features- Addition 2
lbpFeatures = extractLBPFeatures(thisImage);
lbpFeaturesCell{k} = lbpFeatures;
end
The following MATLAB Answers mentions a detailed explanation of the specified additions:
The following MathWorks documentation can be referred to know more:
Thanks.

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by