函数原型:merge(tup)
merge常用于RGB通道图的合并
tup必须是numpy数组
import numpy as npimport matplotlib.pyplot as pltimport cv2image=cv2.imread("dog.jpg")#读取要处理的图片B,G,R = cv2.split(image) #分离出图片的B,R,G颜色通道zeros = np.zeros(image.shape[:2],dtype="uint8")#创建与image相同大小的零矩阵re_image=cv2.merge([R,G,B])fg,ax=plt.subplots()ax.imshow(re_image)
result: