What is a direct way to "colorize" an image in shades of gray. Painting, I mean transferring the values of the intensity of shades of gray to one of the three channels R, G, B in the new image.
For example, 8UC1a grayscale pixel with intensity I = 50should become a color pixel 8UC3with intensity BGR = (50, 0, 0)when the image turns blue.
In Matlab, for example, what I ask for can simply be created using two lines of code:
color_im = zeros([size(gray_im) 3], class(gray_im));
color_im(:, :, 3) = gray_im;
But it is surprising that I can not find anything like it in OpenCV.
source
share