0
$\begingroup$

I have a colour variable with values for different e-commerce products like - olive, teal, blue, green etc.

I want to bin these colours to the primary colour values.

eg -

olive ---> green
teal ----> blue
blue and green will remain the same.

I also have images available of these products, therefore, I am wondering if there is any solution using some clustering technique or using a pre-trained model for classification in some way.

$\endgroup$
1
  • $\begingroup$ You can calculate euclidian distance (three dimentions: red, green, blue) to prime colors. The closest color is your best match. $\endgroup$
    – keiv.fly
    Apr 27, 2020 at 22:54

1 Answer 1

0
$\begingroup$

Since there are small, finite number of color options, it would be straightforward to manually create a dictionary where the key is the primary color and values are a set of other color values.

In Python, it would be something like:

colors = {"blue": {"blue", "teal"},
          "green": {"green", "olive"},
         }
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.