1

Very stupid question, but here it goes.

Scikit-image has a module called 'data'. Such module has plenty of pictures that are used in the examples.

So, for instance:

from skimage import data image = data.camera() # camera being a camera.png file in data 

Now, I want to import my own files into the scripts, but if I add a new file to the data folder, I get back the following error:

module data has no attribute 'whatever' #whatever being the new file I added to data.

3
  • 1
    data is a python module. You'd need to edit some Python code to make it work, unless it's doing something clever with attribute lookups, but I doubt it. Commented Dec 28, 2017 at 14:09
  • 1
    The documentation says you can use data.imread to read any image file, or data.load to load an image from the data directory. Commented Dec 28, 2017 at 14:12
  • Peter, many thanks. Commented Dec 28, 2017 at 14:33

1 Answer 1

1

As an alternative solution with respect to @Peter Wood's comment, skimage.io.imread should do the trick:

In [5]: from skimage import io In [6]: image = io.imread('whatever.png') In [7]: io.imshow(image) Out[7]: <matplotlib.image.AxesImage at 0xf695f98> 

whatever

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.