简体   繁体   English

如何在python中找到GLCM矩阵?

[英]How to find GLCM matrix in python?

We are using Python 2.7.9.and scikit image library. 我们正在使用Python 2.7.9。和scikit图像库。 We are not able to use skimage.feature.greycomatrix because there is no file such as greycomatrix.py in the feature folder. 我们无法使用skimage.feature.greycomatrix因为功能文件夹中没有诸如greycomatrix.py之类的文件。 Their documentation seems to be wrong as it says this function is available. 他们的文档似乎错了,因为它说此功能可用。 We get an error module attribute has no object feature. 我们得到一个错误模块属性没有对象功能。 Is there any other image processing library in Python which will help us achieve this goal? Python中是否还有其他图像处理库可以帮助我们实现这一目标?

from skimage.feature import greycomatrix

This works for me, just like the instructions at http://scikit-image.org/docs/dev/auto_examples/plot_glcm.html . 这对我有用,就像http://scikit-image.org/docs/dev/auto_examples/plot_glcm.html上的说明一样。

Maybe you just have an old version and need to update scikit-image? 也许您只是一个旧版本,需要更新scikit-image? Or if it was actually a bug on their behalf they have probably fixed it now. 或者,如果实际上是代表他们的错误,那么他们现在可能已修复。

Which version of scikit-image do you have? 您有哪个版本的scikit-image? That is more relevant for this problem than your Python version. 这个问题比您的Python版本更重要。 For me: 为了我:

import skimage
print skimage.__version__
'0.11.2'

So for version 0.11.2 up atleast it should work. 因此对于0.11.2或更高版本,它应该可以正常工作。

In my case I use the following imports and it works for me. 就我而言,我使用以下导入,它对我有用。 I say 我说

import skimage.feature as sk
##Then I say 


glcm = sk.greycomatrix(img, [1],[0])

This should work fine. 这应该工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM