当我们想要打开scipy.misc.imsave()包中的图像,出现了这样的报错怎么做
from scipy import misc
import matplotlib.pyplot as plt
f = misc.face()
misc.imsave('face.png', f) # uses the Image module (PIL)
plt.imshow(f)
plt.show()
Traceback (most recent call last):
File "D:/pycharm/pycharm_project/Numpy Matplotlib scipy/scipy图像处理.py", line 4, in <module>
misc.imsave('face.png', f) # uses the Image module (PIL)
AttributeError: module 'scipy.misc' has no attribute 'imsave'
处理方法:
这里需要用到另外一种打开方法:
import imageio
imageio.imsave()
# 例
from scipy import misc
import imageio
import matplotlib.pyplot as plt
f = misc.face()
imageio.imsave('face.png', f)
plt.imshow(f)
plt.show()
输出