Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Another approach:

  1. Quantize all colors of your image into e.g. 16 different colors per channel
  2. Use k-means with k=2 and cluster all colors (one 3-d color vector per pixel) based on the euclidean distance between the colors. The two resulting clusters then separate the colors within your image into two classes.
  3. Use the two cluster centroids (=color means) as your dominant colors.
click to hide/show revision 2
added: A small number of iterations should be sufficient.

Another approach:

  1. Quantize all colors of your image into e.g. 16 different colors per channel
  2. Use k-means with k=2 and cluster all colors (one 3-d color vector per pixel) based on the euclidean distance between the colors. A small number of iterations should be sufficient. The two resulting clusters then separate the colors within your image into two classes.
  3. Use the two cluster centroids (=color means) as your dominant colors.

Another approach:

  1. Optional: Quantize all colors of your image into e.g. 16 different colors per channel
  2. Use k-means with k=2 and cluster all colors (one 3-d color vector per pixel) based on the euclidean distance between the colors. A small number of iterations should be sufficient. The two resulting clusters then separate the colors within your image into two classes.
  3. Use the two cluster centroids (=color means) as your dominant colors.