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.
有关Stefan's answer的详细信息:
scikit-image
不在内部实现IO功能,而是包装并将其委托给外部库(称为"plugings")。在您可以在这里看到受支持的插件https://scikit-image.org/docs/dev/api/skimage.io.html,以及通过调用skimage.io.find_available_plugins为他或她自己的环境提供的插件。 {a5}下面的插件^是特定的。在
您看到的问题与其中一个插件中的dtype验证错误有关。最近,
imageio
插件(https://github.com/scikit-image/scikit-image/pull/3837)也修复了一个类似的bug,它将被合并到0.14.3(LTS)、0.15.1/0.16(最新)版本中。在测试功能,
使用Python 2.7.13、Ipython 5.1.0、skimage 0.13.0、
以及python3.6.7、Ipython 7.4.0、skimage 0.15.0:
您指向文档的链接是skimage0.16.0,但是我认为可以安全地假设文档中只是有一个打字错误。在
编辑:另外,看看source:
相关问题 更多 >
编程相关推荐