python实现单通道图转三通道图

import cv2

mask = cv2.imread('E:/code/photo/3/1.png')
gray = cv2.cvtColor(mask, cv2.COLOR_BGR2GRAY)
img = np.zeros_like(mask)
mask[:, :, 0] = gray
mask[:, :, 1] = gray
mask[:, :, 2] = gray
cv2.imwrite('E:/code/photo/3/3.png', mask)

你可能感兴趣的:(python,计算机视觉,opencv)