2022-01-25

Replace colors in image by closest color in palette using numpy

I have a list of colors, and I have a function closest_color(pixel, colors) where it compares the given pixels' RGB values with my list of colors, and it outputs the closest color from the list.

I need to apply this function to a whole image. When I try to use it pixel by pixel, (by using 2 nested for-loops) it is slow. Is there a better way to achieve this with numpy?



from Recent Questions - Stack Overflow https://ift.tt/3FUsfYZ
https://ift.tt/eA8V8J

No comments:

Post a Comment