小编Nee*_*egi的帖子

Opencv转换为灰度无法正常工作

我一直在尝试使用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
Run Code Online (Sandbox Code Playgroud)

此图像取自CIFAR10数据集.谢谢. 使用opencv后的代码和结果

python opencv matplotlib ipython python-3.x

3
推荐指数
1
解决办法
2899
查看次数

标签 统计

ipython ×1

matplotlib ×1

opencv ×1

python ×1

python-3.x ×1