.. _example_plot_glcm.py:


=====================
GLCM Texture Features
=====================

This example illustrates texture classification using texture
classification using grey level co-occurrence matrices (GLCMs).
A GLCM is a histogram of co-occurring greyscale values at a given
offset over an image.

In this example, samples of two different textures are extracted from
an image: grassy areas and sky areas. For each patch, a GLCM with
a horizontal offset of 5 is computed. Next, two features of the
GLCM matrices are computed: dissimilarity and correlation. These are
plotted to illustrate that the classes form clusters in feature space.

In a typical classification problem, the final step (not included in
this example) would be to train a classifier, such as logistic
regression, to label image patches from new images.


.. image:: images/plot_glcm_1.png
    :align: center


.. literalinclude:: plot_glcm.py
    :lines: 22-



**Python source code:** :download:`download <plot_glcm.py>`
(generated using ``skimage`` |version|)



**IPython Notebook:** :download:`download <./notebook/plot_glcm.ipynb>`
(generated using ``skimage`` |version|)

