加入三个窗口显示rgb通道

This commit is contained in:
2024-09-10 10:39:58 +08:00
parent ac77a9f4d9
commit e39389cf7a
+10 -5
View File
@@ -7,19 +7,24 @@ img = cv.imread("opencv_logo.png",cv.IMREAD_UNCHANGED)
height,width,channel=img.shape height,width,channel=img.shape
# show infos # show infos
print(img.shape)
print("height=\t",height) print("height=\t",height)
print("width=\t",width) print("width=\t",width)
print("channel=\t",height) print("channel=\t",channel)
# split channels # split channels
blue,green,red=cv.split(img) blue,green,red=cv.split(img)
# show channels # show channels
## red channel ## red channel
#cv.imshow("channel", red) cv.namedWindow("red channel")
cv.imshow("red channel", red)
## green channel ## green channel
cv.imshow("channel", green) cv.namedWindow("green channel")
cv.imshow("green channel", green)
## blue channel ## blue channel
#cv.imshow("channel", blue) cv.namedWindow("blue channel")
cv.imshow("blue channel", blue)
cv.waitKey(0) cv.waitKey(0)
cv.destroyWindow("channel") cv.destroyAllWindows()