This doesn't have anything to do with R, but it's too cool not to share. This image of the Mona Lisa is composed of just 50 overlaid semi-transparent polygons:
That's an amazing feat of data compression, but how was it done? In just a few hours, Roger Alsing wrote a genetic algorithm in C# to "evolve" this picture from a DNA string representing the vertices and colors of the 50 polygons. At each iteration, the algorithm mutated the DNA slightly (move or add a vertex, change a color, etc.) and then rendered the image from the 50 polygons. If the "child" image was better than the "parent" image (based on a pixel-by-pixel comparison to a perfect image of the Mona Lisa) it was retained as the next parent, otherwise it was discarded. It took just over 900,000 iterations to create the image above.
You can see the evolution of the image and find more details at Roger Alsing's blog: Genetic Programming: Evolution of Mona Lisa.
Comments