Computing Correlation in graycoprops

1 view (last 30 days)
João Mendes
João Mendes on 14 Oct 2020
Hi everyone,
I was trying to check my calculations with the results provided by graycoprops, however, they don't match.
I don't know what I'm doing wrong, here follows my code:
GLCM_0_norm = GLCM_0 ./ sum (GLCM_0(:)) %for the sum of all elements to be equal to 1, as requested per graycoprops
i=size(GLCM_0_norm,1);
j=size(GLCM_0_norm,2)
for k=1:i
sum_lines(k)=sum(GLCM_0_norm(k,:))
end
mean_row=mean(sum_lines);
std_row=std(sum_lines);
for l=1:j
sum_column(k)=sum(GLCM_0_norm(:,l));
end
mean_col=mean(sum_column);
std_col=std(sum_column);
for k=1:i
for l=1:j
correlation= [(k-mean_row)*(l-mean_col)*GLCM_0_norm(k,l)]/(std_col*std_row)
end
end
Correlation_0=sum(correlation(:));
PS- I can't use graycoprops for my assignment.
Thanks!

Answers (0)

Community Treasure Hunt

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

Start Hunting!