【问题标题】:AttributeError: module 'skimage' has no attribute 'filters'AttributeError:模块“skimage”没有属性“过滤器”
【发布时间】:2021-01-09 09:12:45
【问题描述】:

我有以下代码:

import cv2
import numpy as np
from PIL import Image
import skimage

my_image = cv2.imread('my_image.jpeg', 1)

gray = cv2.cvtColor(my_image, cv2.COLOR_BGR2GRAY)
b = skimage.filters.threshold_local(gray,19,offset=10)
b = Image.fromarray(b)
b = b.convert("L")
b.save('adaptive_output.png')

但我收到以下错误:

b = skimage.filters.threshold_local(gray,19,offset=10)
AttributeError: module 'skimage' has no attribute 'filters'

我使用的是 Python 3.8,我系统上的 scikit-image 版本是 0.18.1。我还尝试了不同 IDE 中的代码,但到处都收到错误。 我还检查了question 1question 2question 3,但他们的答案都没有奏效。

【问题讨论】:

  • 您的项目中有另一个名为skimage.py 的文件吗?
  • @RandomDavis 我检查并确认我的项目中没有名为 skimage.py 的文件。应该还是不应该?

标签: python python-3.x


【解决方案1】:

尝试导入特定属性。像这样:

from skimage import filters

【讨论】:

    猜你喜欢
    • 2021-11-24
    • 2018-04-14
    • 2019-02-18
    • 1970-01-01
    • 2018-09-03
    • 2021-10-06
    • 2020-01-01
    • 2019-07-20
    相关资源
    最近更新 更多