Genetic image evolution

Saturday 13 December 2008

Roger Alsing has made a fascinating image hack: reproduce an image with randomly-placed translucent polygons: Genetic Programming: Evolution of Mona Lisa. At each step, a random polygon is placed on the image, and a simple image comparison function determines whether a new proposed polygon makes it look more or less like the goal image. It’s not fast, but the results are kind of startling. A photo of me and a friend:

Matt and Ned

And a polygonal reproduction with 108 polygons:

Matt and Ned evolved with polygons

This reminds me a little of the CSS Homer, recreating an image by amassing unlikely components in just the right way. BTW: the comments on Roger’s post contain a number of AI nerds debating whether this is truly genetic programming, and if so what kind, or if it is simply a hill-climbing algorithm. In any case, it’s very cool.


André Roberge 10:06 AM on 13 Dec 2008

Any chance you could make your code available? (I'm assuming you wrote a little Python script for this...)

Ned Batchelder 11:29 AM on 13 Dec 2008

@André: I don't know what I can do to make it clearer: I didn't write this at all, Roger Alsing did. There's a link to his blog post in the first sentence..

gumuz 11:54 AM on 13 Dec 2008

cool find

ps. i think you meant 'genetic' programming, instead of generic

Ned Batchelder 12:02 PM on 13 Dec 2008

oops, yes "genetic".

André Roberge 1:18 PM on 13 Dec 2008

Oops, sorry. I had seen the post by Roger Alsing some time last week and I assumed that you had written a program reproducing this idea. My mistake - sorry :-(

Frank Davis 10:44 PM on 13 Dec 2008

It would be very interesting to produce a variation of this technique that works with randomly-placed translucent font characters, mixing Roger Alsing's idea with that of Román Cortés' Homer technique.

Anybody have enough time on their hands to try it?

Jack Diederich 12:18 AM on 14 Dec 2008

How do non-human images look? People see faces everywhere so not very close is often close enough. For instance if I only saw the final image I'd guess you were sitting in a diner in front of a mirror. Or maybe on the Red Line at a station.

karl 6:19 PM on 14 Dec 2008

I'm surprised nobody tried yet to reproduce that in Python. I'm looking right now at the source code of the project. The core features seem to be simple. There is a lot of GUI stuff and config files that could be avoided.

Add a comment:

Ignore this:
Leave this empty:
Name is required. Either email or web are required. Email won't be displayed and I won't spam you. Your web site won't be indexed by search engines.
Don't put anything here:
Leave this empty:
URLs auto-link and some tags are allowed: <a><b><i><p><br><pre>.