无法从“skimage.feature”导入名称“graycomatrix”

Ain*_*sir 7 python scikit-image jupyter-notebook

我已经成功安装了 skimage 软件包,但是当我尝试导入

from skimage.feature import graycomatrix, graycoprops
Run Code Online (Sandbox Code Playgroud)

它会导致错误:

cannot import name 'graycomatrix' from 'skimage.feature' (/Users/ain/opt/anaconda3/lib/python3.8/site-packages/skimage/feature/__init__.py)
Run Code Online (Sandbox Code Playgroud)

小智 8

它的名字是灰瘤。语法是

from skimage.feature import greycomatrix, greycoprops
Run Code Online (Sandbox Code Playgroud)


My *_*ork 5

更准确地说,为了回答 @smcs 的评论并更新已接受的答案,从版本 0.19开始,如本拉取请求中所示,函数被命名graycomatrixgraycoprops并且文档(githubdocs)和教程是正确的。

总结。对于skimage0.19 及更高版本,这是正确的导入和版本:

from skimage.feature import graycomatrix, graycoprops
Run Code Online (Sandbox Code Playgroud)

对于旧版本(但也直到本期提到的 1.0 版本,@Prasanth 的答案是:

from skimage.feature import greycomatrix, greycoprops
Run Code Online (Sandbox Code Playgroud)