Hallo I have 2000 images and for each image I have extracted the 5 main colors (through a Python script), this data is stored in a xml file so that I can relate each image with its 5 main colors.
Now, how would one go about ordering the images by their main colors ? Apart from the vl technical perspective (OrderBy, etc.) I am not sure about the concept behind grouping or ordering palettes (spread of colors).
S.
as colors are inherently multidimensional this can be answered in many different ways.
- a simple way to start would be convert RGB to HSV and sort them by their hue.
- another option would be to really think of RGB values as a 3 dimensional position in a color cube and then find a path through the cube that always chooses the closest color to current color as the next color in the list
- (and many more)
you could also take a look at other colour spaces like LAB for example. each of them maps differently and might be the right fit for your task.
If this is presumed as an ontological problem I would suggest likewise to take in account quantities and qualities, like for instance these 5 color bands have all equal significance? And regarding quantity, do you store also the amount of pixels or a percentage of which colors are dominant? Additionally, these color bands have a constant distance in the Hue domain?
Otherwise, on @motzi track I would also try the Length (in case of non Lab colours - minimizing the dimensions to just one) and if you want more fun then maybe try K-Means / Centroids (and let the machine decide for you).