Working with images and their statistical representation, I came across a site (link broken) describing the use of k-means clustering and histograms to visualise main colors and their distribution in images.

The code on the site was written in Python so I wrote a little sketch in processing to fulfill the task.

kmeans

Pixels of image in HSB-cube with five k-means centers as disc diagram

Even though HSV color space is usually not represented as cube as for example RGB space but rather as a cone or double cone, I chose to use this 3d-coordinate system to scatter plot the pixels of an image. The big dots represent the centers of the clusters and can be seen shuffling around as they are updated to their members center.