问题
#导入ndimage
from scipy import ndimage
#调用imread
fname = "images/" + my_image
image = np.array(ndimage.imread(fname))
报错:
module ‘scipy.ndimage’ has no attribute ‘imread’
环境
-
Python
版本:3.7.4 -
scipy
版本:1.2.1 -
PIL
版本:6.0.0
解决方案
方案一:
-
打开
Cmd
,安装
imageio
pip3 install imageio
-
调用
imageio.imread
import imageio
fname = "images/" + my_image
image = np.array(imageio.imread(fname))
方案二:
from matplotlib.pyplot import imread
参考
版权声明:本文为WUDIxi原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。