MATLAB Answers


Image processing GLCM gray level cooccurance matrix

Asked by NA
on 5 Mar 2013

In function graycomatrix,the output is always 8x8 matrix,i am not getting why its 8x8 ,can anybody help me out


2 Answers

Answer by Youssef Khmou
on 5 Mar 2013


We already discussed that topic , so as to avoid redundancy take a quick look at this topic you will find the answer :


Answer by Teja Muppirala
on 6 Mar 2013

It's just the default setting. You can change the size by using the 'NumLevels' parameter.

For example,

I = imread('pout.tif');
G = graycomatrix(I,'NumLevels', 64);

See the help:

>> help graycomatrix

    'NumLevels'      An integer specifying the number of gray levels to use
                     when scaling the grayscale values in I. 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).
                     'NumLevels' must be an integer. 'NumLevels' must be 2
                     if I is logical.
                     Default: 8 for numeric
                              2 for logical


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!