小编Kin*_*cel的帖子

cv2.cvtcolor bgr2gray 似乎得到一个错误图像

# 代码如下,实现了,但结果可能是错误的,不是我想要的灰度,有人帮我解决,看起来很简单,但我就是不知道哪里错了

import cv2 import matplotlib.pyplot as plt import numpy as np import matplotlib.image as mpimg img = cv2.imread('calibration_test.png')

# i want simply convert the rgb image to grayscale and then print it out
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
plt.imshow(gray)
print(gray.shape)
# but the outcome is a colorful image
Run Code Online (Sandbox Code Playgroud)

我使用的原始图像

丑陋的结果

python bgr cv2

2
推荐指数
1
解决办法
7260
查看次数

标签 统计

bgr ×1

cv2 ×1

python ×1