Wednesday, December 31, 2008

Stochastic reconstruction of images

The Evolution of Mona Lisa by Roger Alsing has inspired a lot of people including myself. So, I have spend a few hours during my Christmas vacation to make my own software version :-)

In short, the algorithm is a simple stochastic hill-climber similar to Roger's (although he claims that it is related to genetic programming - which is not the case). A candidate solution is represented by a set of geometric shapes (either polygons, rectangles, squares, or circles). Each polygon is represented by a set of points (a rectangle is represented by a position, width, and height etc). Moreover, each shape has a color (r,g,b) and an alpha value. The candidate solution is modified using a set of simple variation operators (e.g. change shape color, change position of shape, add or remove shape, etc.). A new candidate solution replaces the previous one if it is better (with repect to a scoring function rewarding pixel color matches and penalizing pixel color deviations). The current scoring function used is the same as the one Roger Alsing uses (I am currently working on other alternatives to the scoring function and optimization algorithm).

I have posted a screenshot of my forthcoming 'Reconstructor' application below. I will post binaries and source-code as soon as I have implemented a few new ideas that I got earlier this week...

Until then you can browse some of the images that I have 'reconstructed'...

Reconstructor prototype