Part of a brief series that started here.
How can we use k-Means to understand and/or manipulate photographic images? As a first example, here’s a classic from the poster-printing world: choosing a very small number of inks to represent a full-tone photo.
In our example, we grab random photos from the web – some work great as posters, some… not so much. But the code will do its best given the narrow constraints: all it knows is grayscale values, and we’ve reduce our calculation to just one dimension: the values along the grayscale histogram from each picture.
“Photos have no narrative content. They only describe light on a surface.” - GW
“Photography is about finding out what can happen in the frame. When you put four edges around some facts, you change those facts.” - Garry Winogrand
This is the first post in a brief series on algorithms (simple methods) that I like and that I think more people should know about: either because of their simplicity, their novelty, their usefulness, or all three. Each comes with a live demo. To begin, let’s introduce: k-Means Clustering .