I have a grayscale image and a some color, represented in RGB triplet. And i need to colorize grayscale image using this triplet.
Conceptually, you'd take the greyscale value of each pixel in the original image and use that as a percentage of the green value. so if a pixel has greyscale value 87, then the equivalent pixel in the colorized image would be:
colorized_red = (87 / 255) * red_component(green_shade);
colorized_green = (87 / 255) * green_component(green_shade);
colorized_blue = (87 / 255) * blue_component(green_shade);