Visual Markov Chains

I've been experimenting with Markov chains lately. They're pretty good for generating text (I've implemented that sort of thing a couple times) and generally fun to play around with.

I had an idea at school for how to generate images with Markov chains. Images are essentially lists of colors. Each color (ideally for our purposes, anyway) shows up multiple times in the list, and is followed by many other colors. So what happens if I construct a Markov chain based on the connection of these colors and let the computer just run through the chain until it's given me enough pixels to make an image?

That's what I did. (Well, that's what I wrote some code to do.) Here's the Processing code I used to generate the below images. Feel free to generate some images with that code if you want and use them for whatever. Drop me a line if you do - I'd love to see what people can do with it.

Source image.
Images generated with the visual Markov chain.

Back to Blog Index