#导入工具包并读入图片
from imutils import *
image = imread('test.jpg')
image.shape
(400, 300, 3)
#切分通道
(R, G, B) = cv2.split(image) print(R.shape) print(G.shape) print(B.shape)
(400, 300) (400, 300) (400, 300)
#合并通道
merged = cv2.merge([R,G,B])
show(merged)
#画出每个通道
cv2.imshow('R',R) cv2.imshow('G',G) cv2.imshow('B',B) cv2.waitKey(0) cv2.destroyAllWindows()