I am currently trying to build a program that will accept a image and replace all of its individual parts 20x20 with individual images (up to a 1000) that are a best visual match.
I researched and learned about avg RGB/Color, my broad idea of how I would build the program is that I first calculate the average Color/RGB
transform the RGB
to CIE-L*ab
and select the image (up to a 1000) that has the smallest difference to a 20x20 pixel of the input image.
I am not asking for code, just some resources that can better help me understand how I get the transformation from RGB
to CIE-L*ab
1976 Comparison.
I am not interested in Euclidian distance to calculate the distances because it does not take human color perception into account. If it helps, i'm building the program in NodeJS
Thank You
How I managed to do it was using two node modules, image-average-color
and color-space
. I first calculated the average color of each image in the collection, converted it to CIE-L*ab
and stored it in an array.
I then extracted each 20x20 block of the input image, calculated the CIE-L*ab
aswell and found the smallest distance in the array to the 20x20 block