Consider a simple glcm matrix.
glcm = [0 1 2 3;1 1 2 3;1 0 2 0;0 0 0 3];
Calculate the statistics using Matlab's built in features.
stats = graycoprops(glcm)
Contrast: 2.8947
Correlation: 0.0783
Energy: 0.1191
Homogeneity: 0.5658
Now, instead, calculate them manually using the definition of these equations as given at the bottom of this page: https://www.mathworks.com/help/images/ref/graycoprops.html
contrast = 0;
energy = 0
for i = 1:4
for j = 1:4
contrast = contrast + glcm(i,j)*(i-j)^2;
energy = energy + glcm(i,j)^2;
end
end
Which gives:
contrast =
110
energy =
43
What is the deal? Is some type of normalization being done? It is not simply dividing by the number of elements which is 16...
Any thoughts? Thanks!