How to calculate the contrast energy, entropy of a ROI(Region of interest) of an image using GLCM feature extractactions method?

조회 수: 15 (최근 30일)
I need to extract GLCM features like energy entropy contrast among others of the REGION OF INTEREST ONLY excluding the black background,i managed to extract those features for the entire image but i only need them for the region of interest knowing that everything else will be black
% Loop over all GLCMs
for k = 1:nglcm
currentGLCM = glcm(:,:,k);
glcmMean(k) = mean2(currentGLCM);
% For symmetric GLCMs, uX = uY
uX(k) = sum(I.*currentGLCM(sub));
uY(k) = sum(J.*currentGLCM(sub));
sX(k) = sum((I-uX(k)).^2.*currentGLCM(sub));
sY(k) = sum((J-uY(k)).^2.*currentGLCM(sub));
out.contrast(k) = sum(abs(I-J).^2.*currentGLCM(sub)); %OK
out.dissimilarity(k) = sum(abs(I - J).*currentGLCM(sub)); %OK
out.energy(k) = sum(currentGLCM(sub).^2); % OK
out.entropy(k) = -nansum(currentGLCM(sub).*log(currentGLCM(sub))); %OK
out.inverseDifference(k) = sum(currentGLCM(sub)./( 1 + abs(I-J) )); %OK
out.homogeneity(k) = sum(currentGLCM(sub)./( 1 + (I - J).^2)); %OK
  댓글 수: 8
Ragini Gaikwad
Ragini Gaikwad 2021년 5월 10일
@Image Analystcalculations of ENERGY ENTROPY CORRELATION CONTRAST, mean and variances for these parameters. and also how to reduce the size of bins in histogram? What does it actually mean..these are my questions. Thank you.
Ragini Gaikwad
Ragini Gaikwad 2021년 5월 13일
Guys, please help me on this. I want to take 10 images form my image database, read them, index them, find grey level and histogram. make bin to size 15. calculate feature vector of each image. calulate ED or MSE.
please help me with this.

댓글을 달려면 로그인하십시오.

답변 (3개)

Phuong Nguyen
Phuong Nguyen 2020년 4월 3일
Did you solve this problem? I am having the same problem with you and cant get over it. If you done, could you please teach me? Thank you.
  댓글 수: 1
Binu
Binu 2020년 5월 8일
Force all pixel values outside your region of interest as a 'NaN'. The graycomatrix methods by default ignores any pixel pairs having a 'NaN' value.

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2017년 6월 5일
graycoprops() returns 4 measurements. Will that do?

Binu
Binu 2017년 8월 4일
The graycomatrix function has a '*GrayLimits*' argument where you can specify a two-element vector [low high] which is used for scaling the image and creating NumLevels. Grayscale values less than or equal to low are scaled to 1. You could set that yours to [0.1 1] for your case.

Community Treasure Hunt

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

Start Hunting!

Translated by