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

