image = np.random.randint(low=0, high=255, size=(210, 160, 3))
cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
运行上面的代码时遇到问题
> Unsupported depth of input image:
> 'VDepth::contains(depth)'
> where
> 'depth' is 4 (CV_32S)
原因是 image 的类型是 int64,把类型修改为 uint8 就行了
image = image.astype(np.uint8)