skimage 0.17.2

ParametersReturnsBackRef
greycomatrix(image, distances, angles, levels=None, symmetric=False, normed=False)

A grey level co-occurrence matrix is a histogram of co-occurring greyscale values at a given offset over an image.

Parameters

image : array_like

Integer typed input image. Only positive valued images are supported. If type is other than uint8, the argument :None:None:`levels` needs to be set.

distances : array_like

List of pixel pair distance offsets.

angles : array_like

List of pixel pair angles in radians.

levels : int, optional

The input image should contain integers in [0, :None:None:`levels`-1], where levels indicate the number of grey-levels counted (typically 256 for an 8-bit image). This argument is required for 16-bit images or higher and is typically the maximum of the image. As the output matrix is at least :None:None:`levels` x :None:None:`levels`, it might be preferable to use binning of the input image rather than large values for :None:None:`levels`.

symmetric : bool, optional

If True, the output matrix :None:None:`P[:, :, d, theta]` is symmetric. This is accomplished by ignoring the order of value pairs, so both (i, j) and (j, i) are accumulated when (i, j) is encountered for a given offset. The default is False.

normed : bool, optional

If True, normalize each matrix :None:None:`P[:, :, d, theta]` by dividing by the total number of accumulated co-occurrences for the given offset. The elements of the resulting matrix sum to 1. The default is False.

Returns

P : 4-D ndarray

The grey-level co-occurrence histogram. The value :None:None:`P[i,j,d,theta]` is the number of times that grey-level :None:None:`j` occurs at a distance d and at an angle :None:None:`theta` from grey-level i. If :None:None:`normed` is :None:None:`False`, the output is of type uint32, otherwise it is float64. The dimensions are: levels x levels x number of distances x number of angles.

Calculate the grey-level co-occurrence matrix.

Examples

Compute 2 GLCMs: One for a 1-pixel offset to the right, and one for a 1-pixel offset upwards.

This example is valid syntax, but we were not able to check execution
>>> image = np.array([[0, 0, 1, 1],
...  [0, 0, 1, 1],
...  [0, 2, 2, 2],
...  [2, 2, 3, 3]], dtype=np.uint8)
... result = greycomatrix(image, [1], [0, np.pi/4, np.pi/2, 3*np.pi/4],
...  levels=4)
... result[:, :, 0, 0] array([[2, 2, 1, 0], [0, 2, 0, 0], [0, 0, 3, 1], [0, 0, 0, 1]], dtype=uint32)
This example is valid syntax, but we were not able to check execution
>>> result[:, :, 0, 1]
array([[1, 1, 3, 0],
       [0, 1, 1, 0],
       [0, 0, 0, 2],
       [0, 0, 0, 0]], dtype=uint32)
This example is valid syntax, but we were not able to check execution
>>> result[:, :, 0, 2]
array([[3, 0, 2, 0],
       [0, 2, 2, 0],
       [0, 0, 1, 2],
       [0, 0, 0, 0]], dtype=uint32)
This example is valid syntax, but we were not able to check execution
>>> result[:, :, 0, 3]
array([[2, 0, 0, 0],
       [1, 1, 2, 0],
       [0, 0, 2, 1],
       [0, 0, 0, 0]], dtype=uint32)
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

skimage.feature.texture.greycomatrix

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /skimage/feature/texture.py#15
type: <class 'function'>
Commit: