#!/usr/bin/env python import numpy as np np.sqrt from skimage.feature import graycomatrix, graycoprops image = np.array([ [0, 0, 1, 1], [0, 0, 1, 1], [0, 2, 2, 2], [2, 2, 3, 3]], dtype=np.uint8 ) g = graycomatrix(image, [1.0, 2.0], [0.0, np.pi / 2.0]) print("contrast = ", graycoprops(g, 'contrast')) print("dissimilarity = ", graycoprops(g, 'dissimilarity')) print("homogeneity = ", graycoprops(g, 'homogeneity')) print("ASM = ", graycoprops(g, 'ASM')) print("energy = ", graycoprops(g, 'energy')) print("correlation = ", graycoprops(g, 'correlation'))