MATLAB Answers

Hi, who can complete my this code. I find feature extraction using GLCM, in below the formula.

2 views (last 30 days)
Oman Wisni
Oman Wisni on 12 Oct 2018
Edited: Oman Wisni on 13 Oct 2018
I know there is a function graycoprops() in Matlab Image Processing Toolbox that computes four parameters Contrast, Correlation, Energy,and Homogeneity. And already trying and work too.
But I want to count GLCM Manually using this formula I get from paper by Haralick to check did the result same or not. Here the formula:
Contrast = sum_i(sum_j( (i-j)^2 * p(i,j) ) );
Correlation = sum_i( sum_j( (i - u_i)(j - u_j)p(i,j)/(s_i.s_j) ) ) ;
Energy = sum_i( sum_j( p(i,j)^2 ) ) ;
Homogeneity = sum_i( sum_j( p(i,j) / (1 + i-j) ) ) (as in matlab);
u_i = sum_i( sum_j( i.p(i,j) ) ) ;
u_j = sum_i( sum_j( j.p(i,j) ) ) ;
s_i = sum_i( sum_j( (i - u_x)^2.p(i,j) ) ) ;
s_j = sum_i( sum_j( (j - u_y)^2.p(i,j) ) ) ;
When i run it, I get error 'not defined variabel p(i,j), sum_i, sum_j'.
So, my question is how to declarad p(i,j). p(i,j) is probability from intensity i and j
May some answers can help. thanks

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by