源代码:
import os
from PIL import Image
import matplotlib.pyplot as plt
img = Image.open(os.path.join('', 'Testsample' + '.png'))
plt.figure("Image") # 图像窗口名称
plt.imshow(img)
plt.axis('on') # 关掉坐标轴为 off
plt.title('image') # 图像题目
plt.show()
去掉plt.show(),就没有错误
错误提示:
AttributeError: 'numpy.ndarray' object has no attribute 'mask'