Having graycomatrix rescaling problem
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
João Mendes
le 9 Avr 2021
Commenté : João Mendes
le 12 Avr 2021
Hi to all,
I am having some trouble using the graycomatrix function. I tried to read the documentation but that did not answered my question.
By default, the input image is rescaled to an image with 8 gray levels. Does anyone knows how is this rescaling performed? Besides the GLCM, I am getting a matrix with all ones as output from the graycomatrix function, which is not the same as I get when i use the rescale function on the original image.
Thank you,
J.
0 commentaires
Réponse acceptée
Steve Eddins
le 12 Avr 2021
Here is the doc for the NumLevels parameter:
Number of gray levels, specified as an integer. For example, if NumLevels is 8, graycomatrix scales the values in I so they are integers between 1 and 8. The number of gray-levels determines the size of the gray-level co-occurrence matrix (glcm).
And here is the code fragment inside graycomatrix.m that performs the scaling:
% Scale I so that it contains integers between 1 and NL.
if GL(2) == GL(1)
SI = ones(size(I));
else
slope = NL / (GL(2) - GL(1));
intercept = 1 - (slope*(GL(1)));
SI = floor(imlincomb(slope,I,intercept,'double'));
end
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!