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
답변 (1개)
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:
'extractLPBFeatures': https://www.mathworks.com/help/vision/ref/extractlbpfeatures.html
Thanks.
카테고리
도움말 센터 및 File Exchange에서 Image Processing and Computer Vision에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!