I have seen this paper yesterday. In this paper the features are taken as contrast, local homogeneity and energy, which all are a single values (as per my knowledge) but according to skimage fuction greycomatrix
, the parameters passed to these that are distances
and angles
(which can be more than one).
Here is my code:
import numpy as np
import cv2
from skimage.feature import greycomatrix, greycoprops
from skimage import io, color, img_as_ubyte
img = cv2.imread('Grape___Black_rot28.JPG')
gray_image = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)
distances = [1, 2, 3]
angles = [0, np.pi/4, np.pi/2, 3*np.pi/4]
glcm = greycomatrix(gray_image,
distances=distances,
angles=angles,
symmetric=True,
normed=True)
properties = ['contrast', 'energy', 'homogeneity', 'correlation', 'dissimilarity']
contrast = greycoprops(glcm, properties[0])
energy = greycoprops(glcm, properties[1])
homogeneity = greycoprops(glcm, properties[2])
correlation = greycoprops(glcm, properties[3])
dissimilarity = greycoprops(glcm, properties[4])
What confuses me is if I generate a glcm of contrast property it will be of 3x4 size but according to the paper it is a single value and even if I consider all 3x4 values of all the properties as a feature, I bet it will have a over-fitting problem for svm model.