Reputation: 3128
Really surprised but I cannot find any documentation on img_arrayndarray
which is what skimage's imread returns.
https://scikit-image.org/docs/dev/api/skimage.io.html#skimage.io.imread
My primary question is what properties/methods etc. this object has.
Alternatively, is there a reason the documentation is so lacking? For example is it common practice to just turn the imread into a numpy array? Thanks
Upvotes: 0
Views: 1375
Reputation: 6510
A bit more details to Stefan's answer:
scikit-image
doesn't internally implements IO capabilities, but rather wraps and delegates them to external libraries (referred to as "plugings").
One can see the supported plugins here - https://scikit-image.org/docs/dev/api/skimage.io.html, and the plugins available for his or her own environment by making a call to skimage.io.find_available_plugins. The plugins are loaded following a specific priority list.
The issue you are seeing is related to the error in dtype validation in one of the plugins. Recently, a similar bug has been fixed for imageio
plugin (https://github.com/scikit-image/scikit-image/pull/3837) and it will be incorporated into 0.14.3 (LTS), 0.15.1/0.16 (latest) releases.
Upvotes: 1
Reputation: 9481
Testing the function,
using Python 2.7.13, Ipython 5.1.0, skimage 0.13.0,
and Python 3.6.7, Ipython 7.4.0, skimage 0.15.0:
In [1]: from skimage import io In [2]: a = io.imread('testimg.tif') In [3]: type(a) Out[3]: numpy.ndarray
your link to the documentation is skimage 0.16.0, but I think it is safe to assume that there simply is a typo in the documentation.
edit: also, looking at the source:
def imread(fname, as_gray=False, plugin=None, flatten=None, **plugin_args): """Load an image from file. Parameters ---------- fname : string Image file name, e.g. ``test.jpg`` or URL. as_gray : bool, optional If True, convert color images to gray-scale (64-bit floats). Images that are already in gray-scale format are not converted. plugin : str, optional Name of plugin to use. By default, the different plugins are tried (starting with imageio) until a suitable candidate is found. If not given and fname is a tiff file, the tifffile plugin will be used. Other Parameters ---------------- plugin_args : keywords Passed to the given plugin. flatten : bool Backward compatible keyword, superseded by `as_gray`. Returns ------- img_array : ndarray The different color bands/channels are stored in the third dimension, such that a gray-image is MxN, an RGB-image MxNx3 and an RGBA-image MxNx4.
Upvotes: 2