我正在使用与SKimage不同的阈值算法,当我导入某些程序包时出现错误,但其他程序没有问题。例如:
from skimage.filter import threshold_adaptive, threshold_isodata
返回回溯:ImportError: cannot import name threshold_isodata
。我正在使用python 2.7,并遵循此处找到的文档:http://scikit-image.org/docs/dev/api/skimage.filter.html#skimage.filter.threshold_isodata
具体来说,我希望使用threshold_isodata和threshold_yen。有人对如何解决此错误有建议吗?另外,还有其他使用相同算法的软件包吗?
如评论中所述,threshold_isodata
仅在主存储库中可用(即未在v0.9中正式发布),因此导入错误。
事实证明threshold_yen
未正确导入版本0.9中的filter
子包中。 (这已在master中修复。)在发布v0.10之前,应按以下方式导入threshold_yen
:
from skimage.filter.thresholding import threshold_yen
EDIT:请注意,此问题和答案特定于scikit-image的非常旧的版本。 skimage.filter
模块在skimage.filters
]中重命名为v0.11