简体   繁体   中英

How to find GLCM matrix in python?

We are using Python 2.7.9.and scikit image library. We are not able to use skimage.feature.greycomatrix because there is no file such as greycomatrix.py in the feature folder. 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?

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 .

Maybe you just have an old version and need to update 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? That is more relevant for this problem than your Python version. For me:

import skimage
print skimage.__version__
'0.11.2'

So for version 0.11.2 up atleast it should work.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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