How to apply colormap to visualize

Hi guys,
using the code below I change the image color space to YCbCr and I wanna show each channel separately but as is shown in the output, all channels are in gray.
Someone said that I have to add colormap using Matplotlib to be colorful.
May I ask you to help me, please?

My code:

import kornia
import torchvision
from torchvision.utils import save_image
img ='./kodak-dataset/kodim01.png')/255
img = kornia.color.rgb_to_ycbcr(img)
y, cr, cb = img.chunk(dim=-3, chunks=3)
save_image(y, f'./y.png')
save_image(cr, f'./cr.png')
save_image(cb, f'./cb.png')

The Output an expected one:

I suggest starting with Colormap reference — Matplotlib 3.4.3 documentation, Choosing Colormaps in Matplotlib — Matplotlib 3.4.3 documentation, and imshow(Z) — Matplotlib 3.5.0.dev2036+gb26dbcd904 documentation

We will be more able to help you if you a specific question about how to use Matplotlib.

1 Like