首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从图像的GLCM计算熵

从图像的GLCM计算熵
EN

Stack Overflow用户
提问于 2016-12-02 04:38:22
回答 1查看 16.6K关注 0票数 14

我正在使用skimage库进行大多数图像分析工作。

我有一个RGB图像,我打算从图像中提取texture功能,如entropyenergyhomogeneitycontrast

下面是我正在执行的步骤:

代码语言:javascript
复制
from skimage import io, color, feature
from skimage.filters import rank
rgbImg = io.imread(imgFlNm)
grayImg = color.rgb2gray(rgbImg)
print(grayImg.shape)  # (667,1000), a 2 dimensional grayscale image

glcm = feature.greycomatrix(grayImg, [1], [0, np.pi/4, np.pi/2, 3*np.pi/4])
print(glcm.shape) # (256, 256, 1, 4)

rank.entropy(glcm, disk(5)) # throws an error since entropy expects a 2-D array in its arguments

rank.entropy(grayImg, disk(5)) # given an output.

我的问题是,从灰度图像(直接)计算的熵是否与从GLCM (纹理特征)提取的熵特征相同?

如果没有,从图像中提取所有纹理特征的正确方法是什么?

注意:我已经提到:

Entropy - skimage

GLCM - Texture features

EN

回答 1

Stack Overflow用户

发布于 2017-01-04 04:45:23

代码语言:javascript
复制
from skimage.feature import greycomatrix, greycoprops

    dis = (greycoprops(glcm, 'dissimilarity'))
    plt.hist(dis.ravel(), normed=True, bins=256, range=(0, 30),facecolor='0.5');plt.show()
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40919936

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档