Hi everybody, first of all, a happy to new year! I am trying to extract GLCM features of my image but I don't understand the results. The GLCM output images are looking quite different, nevertheless that the source is quite similar. I attached three example images and the corresponding GLCM output. I don't really understand why the second example has much brighter values then the other two images. Can anybody tell me what I am doing wrong? Any help would be very appreciated, thanks in advance, Stefanie Here is the code I used: import cv2 import matplotlib.pyplot as plt img = cv2.imread(crop_path + image, 0) glcm_img = np.copy(img) glcm_img[:] = 0 for i in range(glcm_img.shape[0]): for j in range(glcm_img.shape[1]): if i < 3 or j < 3: continue if i > (glcm_img.shape[0] - 4) or j > (glcm_img.shape[0] - 4): continue glcm_window = img[i - 3: i + 4, j - 3: j + 4] glcm = greycomatrix(glcm_window, [1], [0], symmetric=True, normed=True) contrast = greycoprops(glcm, 'dissimilarity') glcm_img[i, j] = contrast plt.imsave(glcm_path + image, glcm_img, cmap=plt.cm.gray)
participants (1)
-
Stefanie Lück