真的很惊讶,但我在 img_arrayndarray
上找不到任何文档,这是skimage的imread返回的内容。
https://scikit-image.org/docs/dev/api/skimage.io.html#skimage.io.imread
我的主要问题是该对象具有哪些属性/方法等。
另外,是否存在文档如此之所以如此?例如,将IMREAD变成一个Numpy数组是常见的做法吗?谢谢
测试功能,
使用python 2.7.13,ipython 5.1.0,猛击0.13.0,
和python 3.6.7,ipython 7.4.0,猛击0.15.0:
In [1]: from skimage import io In [2]: a = io.imread('testimg.tif') In [3]: type(a) Out[3]: numpy.ndarray
您到文档的链接是略微0.16.0,但我认为可以肯定地假设文档中有一个错字。
编辑:另外,查看来源:
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答案的更多详细信息:
scikit-image
不会内部实现IO功能,而是将它们包装并委派给外部库(称为"插入"(。
一个人可以在此处看到受支持的插件-https://scikit-image.org/docs/dev/api/skimage.io.html,以及通过打电话拨打弹药来适合其环境的插件。io.find_available_plugins。插件按照特定的优先级列表加载。
您看到的问题与其中一个插件中DTYPE验证中的错误有关。最近,imageio
插件已解决了类似的错误(https://github.com/scikit-image/scikit-image/pull/3837(,并将其合并到0.14.3(lts(,0.15.1/0.16/0.16(最新(发行。