本文共 593 字,大约阅读时间需要 1 分钟。
matplotlib.pyplot docs :https://matplotlib.org/api/pyplot_summary.html
用matplotlib库显示图片
'''imread(*args, **kwargs) Read an image from a file into an array.imsave(*args, **kwargs) Save an array as in image file.imshow(X[, cmap, norm, aspect, …]) Display an image on the axes.'''import matplotlib.pyplot as plt img = plt.imread('G:\\picture\\2.jpg') plt.imshow(img) plt.show()
matplotlib与PIL.Image结合显示
import matplotlib.pyplot as pltimport matplotlib.image as mpimgimport numpy as npfrom PIL import Imageimg1=Image.open('G:\\picture\\1.jpg')npimg1=np.array(img1)plt.imshow(npimg1)plt.show()
转载地址:http://deqii.baihongyu.com/