Wednesday, December 10, 2008

Genetic Programming: Evolution of Mona Lisa

Genetic Programming: Evolution of Mona Lisa
Trial and error.

What artist has not at some point resorted to “I’ll just try this and see if it looks better.“?

You might say that, in light of Darwin’s model of natural selection, nature itself does the same: make a genetic mutation or two, or a billion, and see what works.

Swedish programmer Roger Alsing has created a playful experiment in “genetic programming” applied to image making, in which he wrote a small program for rendering 50 translucent polygons into an image area.

He set it to mutate slightly with each iteration, so that each pass of the program produces a different distribution of the polygons (the “genetic mutation”).

The fact that the polygons are translucent allows for many smaller subtle shapes within the composition, produced by overlapping areas of color, like laying an area of yellow glaze over both blue and green shapes in an oil painting.

At the end of each rendering sequence, the program uses a “fitness function”, basically a small routine to compare the resultant image pixel by pixel with a target image, in this case an image of the Mona Lisa.

Based on the “fitness” of the image, the program keeps either the new “dna” or the existing “dna”, whichever is more like the target, as the basis of the next mutation and iteration.

Trial and error. Survival of the fittest.

There is a selection of images on Alsing’s blog showing various renders, from which I’ve pulled a few representative samples, above. (For those who are programmatically inclined, there is also a faq with some of the basics.)

Under each of the sample images is a filename that shows the number of times the program had to run to reach that particular image.

The one at bottom-right shows 904,314 incidences of “I’ll just try this and see if it looks better“.

[Via Kottke]

5 thoughts on “Genetic Programming: Evolution of Mona Lisa

  1. JohanM

    I love seeing experiments like this. I have merely peddled at a child’s level compared to the more advanced things being done by people far smarter and with more dedicated time on their hands.
    Always fun to see a fellow Swede do something fun too. ;)

  2. Michelle Reinke

    This is getting highly discussed right now – I love seeing new ways of combining the arts and sciences. The more conventional examples include architecture (engineering and art) and medical illustration (biology and art). Now there’s evolution and art! You have to wonder if someday computers will spontaneously spawn beautiful visual works.

  3. Hanna

    I don’t know why but I really like the 2 pictures in the middle. I could definitaly hand up those up on my wall. I think that by using digital art you can spawn beatiful visual works in a very interesting way.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>