The screenshots below show 2 sets of input images and output sketchs from kmeans. The hatched triangle is a user selected training region to reduce the effect of extraneous data in images (excess background, washed out areas because of lighting, etc....).
$ git clone https://github.com/PeterDSteinberg/kmeans_coloring_book
$ cd kmeans_coloring_book
$ # move your input photos to ./raw_images relative to pwd at this point
$ python -i kmeans_coloring_book.py # starts the interactive plotter / classifier shown below:
Make a coloring book out of any image(s) you have in ./raw_images directory.
Adjust the number of colors (k in kmeans).
I found this script useful qualitatively for exploring the behavior of k-means when the training data (image color vectors) have unequal numbers of observations of each class.
It is interesting to watch the effect of overfitting (making a coloring book picture that is too intricate)
peterdsteinberg [at] g[no space]mail [dot] com