【问题标题】:Can i use glcm features to detect dark spot?我可以使用 glcm 功能来检测黑点吗?
【发布时间】:2018-07-08 13:43:57
【问题描述】:

如何使用 G.L.C.M.在灰度图像中定位暗点的功能?

如果我使用大于 1 的距离,即我尝试为更大的距离制作矩阵,我是否能够检测到大块暗像素?

【问题讨论】:

    标签: image-processing glcm


    【解决方案1】:

    您可以使用对比度、能量、同质性、相关性或相异性等特征。

    这些功能的 Python 代码 -

    import cv2
    import numpy as np
    from skimage.feature import greycomatrix, greycoprops
    img = cv2.imread("spot.jpg")
    gray_image = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    properties = ['contrast','energy', 'homogeneity','correlation','dissimilarity']
    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)
    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])
    #.......................Display.........................
    print(contrast)
    print(energy)
    print(homogeneity)
    print(correlation)
    print(dissimilarity)
    

    【讨论】:

      猜你喜欢
      • 2014-09-04
      • 1970-01-01
      • 2013-05-02
      • 1970-01-01
      • 2011-03-03
      • 1970-01-01
      • 2023-03-13
      • 2019-08-06
      • 1970-01-01
      相关资源
      最近更新 更多