我正在使用 python 程序开发一个带有 numpy、scipy 和 matplotlib.pyplot 包的程序。这是我的代码:
import matplotlib.pyplot as plt
from scipy import misc
im=misc.imread("photosAfterAverage/exampleAfterAverage1.jpg")
plt.imshow(im, cmap=plt.cm.gray)
由于某种原因,图像没有显示(检查我是否得到图像,在那部分一切都很好 - 我可以打印数组。)。
最佳答案
您需要调用 plt.show()
来显示图像。或者将 ipython --pylab
用于支持 matplotlib
的交互式 shell。
关于python - imshow()函数不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16460442/