MATLAB Answers

gugu
0

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

Asked by gugu
on 28 Nov 2017
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

  0 Comments

Sign in to comment.

0 Answers