I have a single channel image gray_image, with pixels values [0 .. 255] and a lookup table mapping those values to colors:
lookup = {
0: [0, 0, 0],
1: [23, 54, 35],
...
255: [200, 52, 20],
}
What is the fastest way to create a new 3 channel image where each pixel is colored based on the lookup of its value in the original images, e.g.
color_image[y, x] = lookup[gray_image[y, x]]
Instead of iterating through every pixel and setting it individually?