- 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.
how i extract features from my image datastore?
2 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Rahul
on 4 Dec 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:
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:
'extractLPBFeatures': https://www.mathworks.com/help/vision/ref/extractlbpfeatures.html
Thanks.
0 Comments
See Also
Categories
Find more on Image Data Workflows 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!