3

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.

2
  • 1
    Do you have another file called skimage.py in your project? Commented Jan 8, 2021 at 23:33
  • @RandomDavis I checked and I confirm there is no file called skimage.py in my project. Should it be or shouldn't? Commented Jan 9, 2021 at 1:06

1 Answer 1

5

Try importing specific attributes. Like this:

from skimage import filters
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.