import cv2 import numpy as np import matplotlib.pyplot as plt img = cv2.imread("gpu.bmp") # 格式转换 # img_out = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY) img_out = cv2.cvtColor(img, cv2.COLOR_RGB2BGR) plt.imshow(img_out) # plt.imshow(img_out, cmap="gray") plt.show()