`imread` is deprecated in SciPy 1.0.0, and will be removed in 1.2.0. Use ``imageio.imread`` instead.


如题干所述,scipy 里面的 imread 读取图片会出错,代码如下:

from scipy import misc

misc.imread("picture/scipy子模块.png")

报错信息为:

D:\ProgramData\Anaconda3\lib\site-packages\ipykernel_launcher.py:3: DeprecationWarning: `imread` is deprecated!
`imread` is deprecated in SciPy 1.0.0, and will be removed in 1.2.0.
Use ``imageio.imread`` instead.
  This is separate from the ipykernel package so we can avoid doing imports until

解决方法:

阅读以上报错信息,发现需要调用 imageio.imread ,而 scipy 中没有 scipy.imageio 子模块。

查阅相关信息,了解到,imageio 是一个独立的模块。

代码修改如下:

import imageio

imageio.imread("picture/scipy子模块.png")

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM