您可以仅复制原始图像并将某些通道设置为0。
import cv2image = cv2.imread('download.jpg')b = image.copy()# set green and red channels to 0b[:, :, 1] = 0b[:, :, 2] = 0g = image.copy()# set blue and red channels to 0g[:, :, 0] = 0g[:, :, 2] = 0r = image.copy()# set blue and green channels to 0r[:, :, 0] = 0r[:, :, 1] = 0# RGB - Bluecv2.imshow('B-RGB', b)# RGB - Greencv2.imshow('G-RGB', g)# RGB - Redcv2.imshow('R-RGB', r)cv2.waitKey(0)


