I want to convert my grey mnist to color. I have came up with the following code, but the output is still gray.

# Import
(train_images0, train_labels0), (test_images, test_labels) = tensorflow.keras.datasets.fashion_mnist.load_data()

# Split
train_images, val_images, train_labels, val_labels = train_test_split(train_images0, train_labels0, test_size=0.20)

#Convert to color BGR
output = cv2.cvtColor(train_images[88],cv2.COLOR_GRAY2BGR)

#Show before and after

Before and after

Can comeone point me in the right direction?

Thanks! :)


1 Answer 1


Have you tried this tutorial to colour the image?


You need to train your model first and then you can convert the image to colour using cv2

    # load the input image from disk, scale the pixel intensities to the
# range [0, 1], and then convert the image from the BGR to Lab color
# space
image = cv2.imread(args["image"])
scaled = image.astype("float32") / 255.0
lab = cv2.cvtColor(scaled, cv2.COLOR_BGR2LAB)```


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.