I use eigenvectors to figure out what might be the most dominant colors in an image. It requires opencv-3+ to run. This code is part of the tutorial here: http://aishack.in/tutorials/dominant-color/
M Orchard and C Bouman, Color Quantization of Images, Transactions on Signal Processing, 1991