【发布时间】: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 1、question 2 和question 3,但他们的答案都没有奏效。
【问题讨论】:
-
您的项目中有另一个名为
skimage.py的文件吗? -
@RandomDavis 我检查并确认我的项目中没有名为
skimage.py的文件。应该还是不应该?
标签: python python-3.x