greycoprops
-
skimage.feature.greycoprops(P, prop='contrast')
[source] -
Calculate texture properties of a GLCM.
Compute a feature of a grey level co-occurrence matrix to serve as a compact summary of the matrix. The properties are computed as follows:
- ‘contrast’:
- ‘dissimilarity’:
- ‘homogeneity’:
- ‘ASM’:
- ‘energy’:
-
- ‘correlation’:
Parameters: P : ndarray
Input array.
P
is the grey-level co-occurrence histogram for which to compute the specified property. The valueP[i,j,d,theta]
is the number of times that grey-level j occurs at a distance d and at an angle theta from grey-level i.prop : {‘contrast’, ‘dissimilarity’, ‘homogeneity’, ‘energy’, ‘correlation’, ‘ASM’}, optional
The property of the GLCM to compute. The default is ‘contrast’.
Returns: results : 2-D ndarray
2-dimensional array.
results[d, a]
is the property ‘prop’ for the d’th distance and the a’th angle.References
[R150] The GLCM Tutorial Home Page, http://www.fp.ucalgary.ca/mhallbey/tutorial.htm Examples
Compute the contrast for GLCMs with distances [1, 2] and angles [0 degrees, 90 degrees]
>>> image = np.array([[0, 0, 1, 1], ... [0, 0, 1, 1], ... [0, 2, 2, 2], ... [2, 2, 3, 3]], dtype=np.uint8) >>> g = greycomatrix(image, [1, 2], [0, np.pi/2], levels=4, ... normed=True, symmetric=True) >>> contrast = greycoprops(g, 'contrast') >>> contrast array([[ 0.58333333, 1. ], [ 1.25 , 2.75 ]])
Please login to continue.