I need to solve the following problem:
INPUT: Image IM, Palette PA
OUTPUT: IM only with the colours of PA
The input image is in RGB but I can convert it to HSV. The colour target palette I specify contains at the moment: black, white, light gray, gray, dark gray, blue, pink, red, purple, green, yellow, brown, orange.
I searched a lot for that, but I can only find reducing an image to the most common colours or reducing it to a fixed palette like 16 colours EGA graphics.
I found the best answer of this: How do I convert any image to a 4-color paletted image using the Python Imaging Library?
It has an input palette and reduces the image to that. Is there an equal way to do in in OpenCV with C++ ?