Friday, March 08, 2013

Genetic Programming: Evolution of Mona Lisa

You will wonder what this evolution is all about. In simple words you are given a empty plain canvas and you are asked to program the computer to display the picture of Mona Lisa. But you have to generate the image and not place it or copy it pixel by pixel and you have to do this such that the final image is obtained in short span of time (optimally short).
         Roger Alsing came up with a interesting solution to this challenge by using polygons to generate the picture of Mona Lisa.So this is how it works:

  • Generate a random Polygon and draw it in the canvas
  • Read the canvas pixel be pixel and compare it with the source Image
  • Mutate (i.e evolve or add a new polygon) the current Image and compare the old one with the new Mutated Image.
  • If the Mutated image has better fitness (when comparing with source Image), then draw the image in the canvas.
  • Repeat this till the fitness is constant.
Amazingly it took only 50 Iterations for the Mona Lisa Picture to appear.The code, FAQ can be gathered from Roger Alsing's official website. The source code is available on github and also a working desktop application can be downloaded from here.

Stay tuned for more.


Post a Comment