How can I extract the GLCM features from each nucleus of mircroscope blood smear image?

1 vue (au cours des 30 derniers jours)
I want to extract GLCM features for each nucleus as in my attached image. Extracting shape features for each cell using regionprops is ok but I have no idea how to extract texture features for each cell using graycoprops. Please give me a piece of advice.
bw
grayNucleus
Here is my code:
% code
cells = bwconncomp(bw);
cellsdata = regionprops(cells, 'Area','BoundingBox','MajorAxisLength','MinorAxisLength','Eccentricity','ConvexArea','Orientation','Extent','Solidity','Perimeter','EquivDiameter');
numberOfCells = size(cellsdata, 1);
%Shape Features
for k = 1 : numberOfCells
Area=cellsdata(k).Area;%F1
BoundingBox=cellsdata(k).BoundingBox;%F2
MajorAxisLength=cellsdata(k).MajorAxisLength;%F3
MinorAxisLength=cellsdata(k).MinorAxisLength;%F4
Eccentricity=cellsdata(k).Eccentricity;%F5
ConvexArea=cellsdata(k).ConvexArea;%F6
Orientation=cellsdata(k).Orientation;%F7
Extent=cellsdata(k).Extent;%F8
Solidity=cellsdata(k).Solidity;%F9
Perimeter=cellsdata(k).Perimeter;%F10
ED=cellsdata(k).EquivDiameter;%F11
SFeature(k,:)=[Area BoundingBox MajorAxisLength MinorAxisLength Eccentricity ConvexArea Orientation Extent Solidity Perimeter ED];
end
%GLCM features
offsets = [0 1; -1 1;-1 0;-1 -1];
[glcms, SI] = graycomatrix(grayNucleus,'Offset',offsets);
stats = graycoprops(glcms,{'Contrast','Correlation','Energy','Homogeneity'});
for k=1:numberOfCells
Contrast= stats.Contrast;
Correlation = stats.Correlation;
Energy = stats.Energy;
Homogeneity = stats.Homogeneity;
TextureFeatures(k,:)=[Contrast Correlation Energy Homogeneity]; % It returns the same glcm features values for all cells
end

Réponses (1)

Constantino Carlos Reyes-Aldasoro
One way to do this would be to crop each region, once you have found each object, you can use regionprops to determine the extremes or the bounding box, use that and address your matrix so that you select only the region of interest and then use that as the input to your texture analysis.

Community Treasure Hunt

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

Start Hunting!

Translated by