plpm
plpm

Reputation: 599

AttributeError: module 'skimage' has no attribute 'filters'

I have the following code:

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')

But I receive the following error:

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

I am using Python 3.8 and the scikit-image version on my system is 0.18.1. I also tried the code in different IDE's but received the error everywhere. I have also checked question 1, question 2 and question 3 but none of their answers worked.

Upvotes: 3

Views: 6947

Answers (1)

DapperDuck
DapperDuck

Reputation: 2859

Try importing specific attributes. Like this:

from skimage import filters

Upvotes: 5

Related Questions