使用OpenCV,读取输入图像(蓝色背景图像圣诞树内)。
下图是输入图像。
读取图像的输出从蓝色背景变为红色。
当我在spyder中查看'image'变量的值时。这里3是RGB通道
轴= 1,此处为0 BGR
轴= 2。我被困在这里。我不明白(像素)RBG值的三元组值如何转换为每个像素的单个值以及此像素(0,0)= 254如何表示此处的红色。
我知道黑白值在0到255之间变化。但是这里轴= 2(像素(0,0)= 254)表示红色(从读取图像的输出猜测)。
您正在使用OpenCV读取图像,其中它采用BGR颜色通道矩阵。但是,您使用其他一些将颜色通道矩阵作为RGB的库来显示它。使用cv2.cvtColor(image, cv2.BGR2RGB)
将图像转换为RGB,然后显示它。