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

2 views (last 30 days)
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);
Where:
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
  2 Comments
Oman Wisni
Oman Wisni on 13 Oct 2018
Edited: Oman Wisni on 13 Oct 2018
built-in function ? how that?
I already create new function for find only GLCM, but I get difficult when I declarad this variabel p(i,j), sum_i, sum_j'.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!