Evolving Mona Lisa

Image credit: 

Last month I pointed to a stunt (er, experiment?) in which the Mythbusters painted Leonardo's Mona Lisa using a computer-controlled paint gun. Now, programmer Roger Alsing has written an evolving program to "paint" Mona Lisa using just 50 polygons. "Huh?" you may say. Well, let's let Alsing explain the steps his program runs:

0) Setup a random DNA string (application start)

1) Copy the current DNA sequence and mutate it slightly
2) Use the new DNA to render polygons onto a canvas
3) Compare the canvas to the source image
4) If the new painting looks more like the source image than the previous painting did, then overwrite the current DNA with the new DNA
5) repeat from 1

The "DNA" is just the instructions to draw the polygons -- what their shape, size, position, and color are. By stepping through the instructions above, Alsing's program draws a random picture, compares its picture to the real Mona Lisa, and slowly the program converges on a solution that looks surprisingly like the real thing. Here's a comparison the first frame (all black) to the final frame (after 904,314 "generations" of running the rules above):

This is called "genetic programming" because it evolves its way to a solution, using a selection process (in this case, comparison to the real Mona Lisa) to select new generations' DNA. Alsing's program took about three hours to generate its Mona Lisa, running on a laptop. Read the FAQ or view selected generations for more nerdy goodness.

(Via Waxy.org.)

More from mental_floss...

December 10, 2008 - 2:12pm
webby
submit to reddit