Image does not load as grayscale (skimage)
1 answer
From the scikit-image documentation, the signature data.imread
looks like this:
skimage.data.imread(fname, as_grey=False, plugin=None, flatten=None, **plugin_args)
Your code is not working correctly because the keyword argument as_grey
has a spelling mistake (you put as_gray
).
Run example
In [4]: from skimage import data
In [5]: img_3d = data.imread('my_image.png', as_grey=False)
In [6]: img_3d.dtype
Out[6]: dtype('uint8')
In [7]: img_3d.shape
Out[7]: (256L, 640L, 3L)
In [8]: img_2d = data.imread('my_image.png', as_grey=True)
In [9]: img_2d.dtype
Out[9]: dtype('float64')
In [10]: img_2d.shape
Out[10]: (256L, 640L)
+2
source to share