#single channel image
# shape of img is [x, y]
# repeat as three channels
# shape of img_3channel is [x, y, 3]
img_3channel = np.repeat(img[..., np.newaxis], 3, 2)
#single channel image
# shape of img is [x, y]
# repeat as three channels
# shape of img_3channel is [x, y, 3]
img_3channel = np.repeat(img[..., np.newaxis], 3, 2)