# Import libraries
import cv2
import numpy as np
import skimage.feature as sk

# Read an image from the disk and convert it into grayscale
image = cv2.imread("images/nature.jpg")
image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

# Calculate GLCM of the grayscale image
glcm = sk.greycomatrix(image, [2], [0, np.pi/2])

# Calculate Contrast
contrast = sk.greycoprops(glcm)
print("Contrast: ", contrast)

# Calculate 'dissimilarity'
dissimilarity = sk.greycoprops(glcm, prop='dissimilarity')
print("Dissimilarity: ", dissimilarity)

# Calculate 'homogeneity'
homogeneity = sk.greycoprops(glcm, prop='homogeneity')
print("Homogeneity: ", homogeneity)

# Calculate 'ASM'
ASM = sk.greycoprops(glcm, prop='ASM')
print("ASM: ", ASM)

# Calculate 'energy'
energy = sk.greycoprops(glcm, prop='energy')
print("Energy: ", energy)

# Calculate 'correlation'
correlation = sk.greycoprops(glcm, prop='correlation')
print("Correlation: ", correlation)
85e710cee2ed7e58b902c0277b5d3660719a733a
<mask token>

<mask token>
print('Contrast: ', contrast)
<mask token>
print('Dissimilarity: ', dissimilarity)
<mask token>
print('Homogeneity: ', homogeneity)
<mask token>
print('ASM: ', ASM)
<mask token>
print('Energy: ', energy)
<mask token>
print('Correlation: ', correlation)

<mask token>
image = cv2.imread('images/nature.jpg')
image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
glcm = sk.greycomatrix(image, [2], [0, np.pi / 2])
contrast = sk.greycoprops(glcm)
print('Contrast: ', contrast)
dissimilarity = sk.greycoprops(glcm, prop='dissimilarity')
print('Dissimilarity: ', dissimilarity)
homogeneity = sk.greycoprops(glcm, prop='homogeneity')
print('Homogeneity: ', homogeneity)
ASM = sk.greycoprops(glcm, prop='ASM')
print('ASM: ', ASM)
energy = sk.greycoprops(glcm, prop='energy')
print('Energy: ', energy)
correlation = sk.greycoprops(glcm, prop='correlation')
print('Correlation: ', correlation)

import cv2
import numpy as np
import skimage.feature as sk
image = cv2.imread('images/nature.jpg')
image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
glcm = sk.greycomatrix(image, [2], [0, np.pi / 2])
contrast = sk.greycoprops(glcm)
print('Contrast: ', contrast)
dissimilarity = sk.greycoprops(glcm, prop='dissimilarity')
print('Dissimilarity: ', dissimilarity)
homogeneity = sk.greycoprops(glcm, prop='homogeneity')
print('Homogeneity: ', homogeneity)
ASM = sk.greycoprops(glcm, prop='ASM')
print('ASM: ', ASM)
energy = sk.greycoprops(glcm, prop='energy')
print('Energy: ', energy)
correlation = sk.greycoprops(glcm, prop='correlation')
print('Correlation: ', correlation)

# Import libraries
import cv2
import numpy as np
import skimage.feature as sk

# Read an image from the disk and convert it into grayscale
image = cv2.imread("images/nature.jpg")
image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

# Calculate GLCM of the grayscale image
glcm = sk.greycomatrix(image, [2], [0, np.pi/2])

# Calculate Contrast
contrast = sk.greycoprops(glcm)
print("Contrast: ", contrast)

# Calculate 'dissimilarity'
dissimilarity = sk.greycoprops(glcm, prop='dissimilarity')
print("Dissimilarity: ", dissimilarity)

# Calculate 'homogeneity'
homogeneity = sk.greycoprops(glcm, prop='homogeneity')
print("Homogeneity: ", homogeneity)

# Calculate 'ASM'
ASM = sk.greycoprops(glcm, prop='ASM')
print("ASM: ", ASM)

# Calculate 'energy'
energy = sk.greycoprops(glcm, prop='energy')
print("Energy: ", energy)

# Calculate 'correlation'
correlation = sk.greycoprops(glcm, prop='correlation')
print("Correlation: ", correlation)