Using scipy.misc.imread () method reads grayscale wrong reasons and solutions

 As shown above, the module uses scipy.misc function reads the png format imread grayscale images, but given, the system prompts:

AttributeError: module 'scipy.misc' has no attribute 'imread'

Reason that scipy.misc.imread () and imsave () has been abandoned, then we can not read the image of these two functions, we can use instead of the above method imageio.imwrite imageio.imread and function.

Solution:

Installation imageio library

In the directory where the command window pip.exe (c: \ Program Files \ Python \ Scripts) Enter the following command:

pip install imageio

After a successful installation, and then introduced into the module imageio as:

Note: If you want to read grayscale, will have to add parameters as_gray = True;

Published 39 original articles · won praise 8 · views 9170

Guess you like

Origin blog.csdn.net/cxd3341/article/details/104095550