Having graycomatrix rescaling problem

Technical Source
2 min readFeb 21, 2022

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.

NOTE:-

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

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

SEE COMPLETE ANSWER CLICK THE LINK

--

--

Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.