img = np.array([[1, 2], [3, 4]])
stacked_img = np.stack((img,)*3, axis=-1)
print(stacked_img)
OR
import cv2
import cv
color_img = cv2.cvtColor(gray_img, cv.CV_GRAY2RGB)
参考:
[1] https://stackoverflow.com/questions/40119743/convert-a-grayscale-image-to-a-3-channel-image
[2] https://www.quora.com/How-do-I-convert-a-grayscale-image-to-an-RGB-image-in-Python