我一直在尝试使用Python中的opencv将图像转换为灰度,但它将图像转换为某种热像仪图像.我究竟做错了什么?以下是图片的代码:
img =X_tr[9999] plt.imshow(img) plt.show() img = cv2.cvtColor(img.astype(np.uint8), cv2.COLOR_RGB2GRAY) plt.imshow(img) plt.show() img.shape
此图像取自CIFAR10数据集.谢谢.
python opencv matplotlib ipython python-3.x
ipython ×1
matplotlib ×1
opencv ×1
python ×1
python-3.x ×1