A question about choose different part ROI of the same image to caculate the GLCM and segment the image

2 views (last 30 days)
Hello everyone,I have a quesetion about GLCM extract.
Now I have a B-scan of the tumor. I want to select the region of interest in the tumor area and the normal tissue area and calculate the GLCM. Then use SVM to segment the entire image.
So if the ‘NumLevels’ I use in ‘graycomatrix’ is 16, do I need to convert the full image to 16 gray values in advance?THANK YOU!

Answers (1)

Harikrishnan Balachandran Nair
From my understanding, you want to know if you must scale the image in advance before calculating the GLCM, depending on the number of levels that you specify.
You need not scale your entire image in advance. The ‘graycomatrix’ Function scales your input image, which might be a subset of the whole image, into the number of levels specified by NumLevels’. By default, the image is scaled by dividing its range of intensities into equal bins, ranging from the lowest intensity in the image given as input, to the highest in the same. You can however change this range according to your need by adding the value to the ‘GrayLimits property, inside the function.
[glcm,SI] = graycomatrix(I,'NumLevels',16,'GrayLimits',[low,high]) ;
As an example, in the above line of code, the image I is scaled to 16 levels, by dividing the range from ‘low’ to ‘high’ into 16 equal bins. The scaled image is stored in ‘SI.’

Community Treasure Hunt

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

Start Hunting!