How to calculate the contrast energy, entropy of a ROI(Region of interest) of an image using GLCM feature extractactions method?
Ältere Kommentare anzeigen
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 Kommentare
Rena Berman
am 2 Aug. 2017
(Answers Dev) Restored edit
Ragini Gaikwad
am 9 Mai 2021
Can anyone tell what is SUB here, as I tried to replace it with image name..it gave me an error as index exeeds matrix dimensions.. pls help
Image Analyst
am 9 Mai 2021
@Elias Unk has not been seen here in 4 years, so who knows? Just ignore his old code, which does not work anyway, and start a new question and explain what you want to do. Attach your image also.
Ragini Gaikwad
am 10 Mai 2021
Thank you..I want to perform Texture Feature for CBIR.. I am stuck up at the calculations of ENERGY ENTROPYCORRELATION CONTRAST..can you help me in this regard..
Image Analyst
am 10 Mai 2021
@Ragini Gaikwad, it does not look like you started a new question with your image attached.
See my attached demo.
Ragini Gaikwad
am 10 Mai 2021
Hi
This is the image attached..and there are around 9908 such images... As I am completley new to this topic..I am stuck up at simple calculations. But, the demo shared by you is very interesting. Thank you so much for taking up mu doubts..it would be really helpful.
Ragini Gaikwad
am 10 Mai 2021
@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
am 13 Mai 2021
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.
Antworten (3)
Phuong Nguyen
am 3 Apr. 2020
1 Stimme
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 Kommentar
Binu
am 8 Mai 2020
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.
https://www.mathworks.com/help/images/ref/graycomatrix.html#namevaluepairarguments (read Algorithms section)
Image Analyst
am 5 Jun. 2017
0 Stimmen
graycoprops() returns 4 measurements. Will that do?
1 Kommentar
Elias Unk
am 16 Jun. 2017
Binu
am 4 Aug. 2017
0 Stimmen
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.
2 Kommentare
Usuma
am 11 Jul. 2019
But in this method black pixels of ROI are neglected. Is there any accurate solution for this? Can anybody help?
Image Analyst
am 11 Jul. 2019
Then don't use GrayLimits.
Kategorien
Mehr zu Biomedical Imaging finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!