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’:
![\sum_{i,j=0}^{levels-1} P_{i,j}\left[\frac{(i-\mu_i) \(j-\mu_j)}{\sqrt{(\sigma_i^2)(\sigma_j^2)}}\right]](http://scikit-image.org/docs/0.12.x/_images/math/445e6743bd7a4e8f4e2c6e525a3beaf48b3d256c.png)
Parameters: P : ndarray
Input array.
Pis 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 ]]) - ‘contrast’:
Please login to continue.