AttributeError:模块“skimage”没有属性“filters”

plp*_*lpm 3 python python-3.x

我有以下代码:

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')
Run Code Online (Sandbox Code Playgroud)

但我收到以下错误:

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

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

Dap*_*uck 5

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

from skimage import filters
Run Code Online (Sandbox Code Playgroud)