how i extract features from my image datastore?

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

Réponses (1)

Rahul
Rahul le 4 Déc 2024
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.

Catégories

En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange

Question posée :

le 13 Avr 2020

Réponse apportée :

le 4 Déc 2024

Community Treasure Hunt

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

Start Hunting!

Translated by