indragiek / DominantColor

Finding dominant colors of an image using k-means clustering
MIT License
960 stars 93 forks source link

Sorting more and grouping each results by hue representativeness or similarity is needed. #30

Open metasmile opened 8 years ago

metasmile commented 8 years ago

First of all, Thank you for your nice work! Awesome. But in general case, library users finally needs only 1~2 color groups like primary, secondary or background(outbound) colors. Currently the result seems that in each 2 items are pretty similar. Also in this example https://github.com/indragiek/DominantColor/raw/master/mac.png, I think first color is not dominant color, it may be secondary or background with the last color.

Currently you did perform it by "size" like following.

// Sort the clusters by size in descending order so that the
// most dominant colors come first.
 clusters.sortInPlace { $0.size > $1.size }

Are you have some plans to improve? Or, please let me know some hints or important parts of your lib.

Thanks.