Module Expr Str Import alias identifier ImportFrom alias alias ImportFrom alias Assign NameStore Num Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore ListLoad TupleLoad Num Num TupleLoad Num Num TupleLoad Num Num TupleLoad Num Num Assign NameStore ListLoad For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad ExtSlice Slice SubscriptLoad NameLoad Index Num BinOpAdd SubscriptLoad NameLoad Index Num NameLoad Slice SubscriptLoad NameLoad Index Num BinOpAdd SubscriptLoad NameLoad Index Num NameLoad Assign NameStore ListLoad TupleLoad Num Num TupleLoad Num Num TupleLoad Num Num TupleLoad Num Num Assign NameStore ListLoad For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad ExtSlice Slice SubscriptLoad NameLoad Index Num BinOpAdd SubscriptLoad NameLoad Index Num NameLoad Slice SubscriptLoad NameLoad Index Num BinOpAdd SubscriptLoad NameLoad Index Num NameLoad Assign NameStore ListLoad Assign NameStore ListLoad For NameStore BinOpAdd NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad ListLoad Num ListLoad Num Num keyword NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr SubscriptLoad Call NameLoad NameLoad Str Index TupleLoad Num Num Expr Call AttributeLoad NameLoad attr SubscriptLoad Call NameLoad NameLoad Str Index TupleLoad Num Num Assign NameStore Call AttributeLoad NameLoad attr keyword TupleLoad Num Num Assign NameStore Call AttributeLoad NameLoad attr Num Num Num Expr Call AttributeLoad NameLoad attr NameLoad keyword AttributeLoad AttributeLoad NameLoad attr attr keyword Str keyword Num keyword Num For TupleStore NameStore NameStore NameLoad body Expr Call AttributeLoad NameLoad attr BinOpAdd NameLoad BinOpDiv NameLoad Num BinOpAdd NameLoad BinOpDiv NameLoad Num Str For TupleStore NameStore NameStore NameLoad body Expr Call AttributeLoad NameLoad attr BinOpAdd NameLoad BinOpDiv NameLoad Num BinOpAdd NameLoad BinOpDiv NameLoad Num Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr ListLoad Expr Call AttributeLoad NameLoad attr ListLoad Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Num Num Num Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Slice Call NameLoad NameLoad SubscriptLoad NameLoad Slice Call NameLoad NameLoad Str keyword Str Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Slice Call NameLoad NameLoad SubscriptLoad NameLoad Slice Call NameLoad NameLoad Str keyword Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr For TupleStore NameStore NameStore Call NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Num Call NameLoad NameLoad BinOpAdd BinOpAdd BinOpMult Call NameLoad NameLoad Num NameLoad Num Expr Call AttributeLoad NameLoad attr NameLoad keyword AttributeLoad AttributeLoad NameLoad attr attr keyword Str keyword Num keyword Num Expr Call AttributeLoad NameLoad attr BinOpMod Str BinOpAdd NameLoad Num For TupleStore NameStore NameStore Call NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Num Call NameLoad NameLoad BinOpAdd BinOpAdd BinOpMult Call NameLoad NameLoad Num NameLoad Num Expr Call AttributeLoad NameLoad attr NameLoad keyword AttributeLoad AttributeLoad NameLoad attr attr keyword Str keyword Num keyword Num Expr Call AttributeLoad NameLoad attr BinOpMod Str BinOpAdd NameLoad Num Expr Call AttributeLoad NameLoad attr Str keyword Num Expr Call AttributeLoad NameLoad attr
N/A N/A 
=====================
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.

 N/A matplotlib.pyplot plt skimage.feature greycomatrix greycoprops skimage data N/A PATCH_SIZE 21 N/A image N/A N/A data camera N/A grass_locations N/A N/A 474 291 N/A 440 433 N/A 466 18 N/A 462 236 N/A grass_patches N/A N/A loc grass_locations N/A N/A N/A N/A grass_patches append N/A image N/A N/A N/A loc N/A 0 N/A N/A loc N/A 0 PATCH_SIZE N/A N/A loc N/A 1 N/A N/A loc N/A 1 PATCH_SIZE N/A sky_locations N/A N/A 54 48 N/A 21 233 N/A 90 380 N/A 195 330 N/A sky_patches N/A N/A loc sky_locations N/A N/A N/A N/A sky_patches append N/A image N/A N/A N/A loc N/A 0 N/A N/A loc N/A 0 PATCH_SIZE N/A N/A loc N/A 1 N/A N/A loc N/A 1 PATCH_SIZE N/A xs N/A N/A ys N/A N/A patch N/A grass_patches sky_patches N/A N/A glcm N/A greycomatrix patch N/A 5 N/A 0 256 symmetric True normed True N/A N/A N/A xs append N/A N/A greycoprops glcm dissimilarity N/A N/A 0 0 N/A N/A N/A ys append N/A N/A greycoprops glcm correlation N/A N/A 0 0 N/A fig N/A N/A plt figure figsize N/A 8 8 N/A ax N/A N/A fig add_subplot 3 2 1 N/A N/A N/A ax imshow image cmap N/A N/A plt cm gray interpolation nearest vmin 0 vmax 255 N/A N/A y x grass_locations N/A N/A N/A N/A ax plot N/A x N/A PATCH_SIZE 2 N/A y N/A PATCH_SIZE 2 gs N/A N/A y x sky_locations N/A N/A N/A N/A ax plot N/A x N/A PATCH_SIZE 2 N/A y N/A PATCH_SIZE 2 bs N/A N/A N/A ax set_xlabel Original Image N/A N/A N/A ax set_xticks N/A N/A N/A N/A ax set_yticks N/A N/A N/A N/A ax axis image N/A ax N/A N/A fig add_subplot 3 2 2 N/A N/A N/A ax plot N/A xs N/A N/A len grass_patches N/A ys N/A N/A len grass_patches go label Grass N/A N/A N/A ax plot N/A xs N/A N/A len grass_patches N/A ys N/A N/A len grass_patches bo label Sky N/A N/A N/A ax set_xlabel GLCM Dissimilarity N/A N/A N/A ax set_ylabel GLVM Correlation N/A N/A N/A ax legend N/A N/A i patch N/A enumerate grass_patches N/A N/A ax N/A N/A fig add_subplot 3 N/A len grass_patches N/A N/A N/A N/A len grass_patches 1 i 1 N/A N/A N/A ax imshow patch cmap N/A N/A plt cm gray interpolation nearest vmin 0 vmax 255 N/A N/A N/A ax set_xlabel N/A Grass %d N/A i 1 N/A N/A i patch N/A enumerate sky_patches N/A N/A ax N/A N/A fig add_subplot 3 N/A len sky_patches N/A N/A N/A N/A len sky_patches 2 i 1 N/A N/A N/A ax imshow patch cmap N/A N/A plt cm gray interpolation nearest vmin 0 vmax 255 N/A N/A N/A ax set_xlabel N/A Sky %d N/A i 1 N/A N/A N/A fig suptitle Grey level co-occurrence matrix features fontsize 14 N/A N/A N/A plt show