hn-classics/_stories/2008/4912964.md

116 lines
3.2 KiB
Markdown
Raw Permalink Normal View History

---
created_at: '2012-12-12T23:02:36.000Z'
title: Mona Lisa in 50 polygons, using a genetic algorithm (2008)
url: http://rogeralsing.com/2008/12/07/genetic-programming-evolution-of-mona-lisa/?hn
author: liamk
points: 206
story_text: ''
comment_text:
num_comments: 54
story_id:
story_title:
story_url:
parent_id:
created_at_i: 1355353356
_tags:
- story
- author_liamk
- story_4912964
objectID: '4912964'
2018-06-08 12:05:27 +00:00
year: 2008
---
2018-03-03 09:35:28 +00:00
**Added FAQ here:**
[**http://rogeralsing.com/2008/12/09/genetic-programming-mona-lisa-faq/**](http://rogeralsing.com/2008/12/09/genetic-programming-mona-lisa-faq/)
**Added Gallery here:**
[**http://rogeralsing.com/2008/12/11/genetic-gallery/**](http://rogeralsing.com/2008/12/11/genetic-gallery/)
2018-02-23 18:19:40 +00:00
2018-03-03 09:35:28 +00:00
This weekend I decided to play around a bit with genetic programming and
put evolution to the test, the test of fine art :-)
2018-02-23 18:19:40 +00:00
2018-03-03 09:35:28 +00:00
I created a small program that keeps a string of DNA for polygon
rendering.
The procedure of the program is quite simple:
2018-02-23 18:19:40 +00:00
2018-03-03 09:35:28 +00:00
- Setup a random DNA string  (application start)
<!-- end list -->
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
Now to the interesting part:
**Could you paint a replica of the Mona Lisa using only 50 semi
transparent polygons?**
That is the challenge I decided to put my application up to.
The image below is the result of that test:
The number below each image is the number of generations it took to
reach that specific
painting.
![evolutionofmonalisa1](https://rogeralsing.files.wordpress.com/2008/12/evolutionofmonalisa1.gif?w=660
"evolutionofmonalisa1")
So what do you think?
**\[EDIT\]
Added FAQ here:
[**http://rogeralsing.com/2008/12/09/genetic-programming-mona-lisa-faq/**](http://rogeralsing.com/2008/12/09/genetic-programming-mona-lisa-faq/)
**Added Gallery here:**
[**http://rogeralsing.com/2008/12/11/genetic-gallery/**](http://rogeralsing.com/2008/12/11/genetic-gallery/)**
### Share this:
- [](https://rogerjohansson.blog/2008/12/07/genetic-programming-evolution-of-mona-lisa/?share=twitter "Click to share on Twitter")
Twitter
- [](https://rogerjohansson.blog/2008/12/07/genetic-programming-evolution-of-mona-lisa/?share=facebook "Share on Facebook")
Facebook
- [](https://rogerjohansson.blog/2008/12/07/genetic-programming-evolution-of-mona-lisa/?share=reddit "Click to share on Reddit")
Reddit
- [](https://rogerjohansson.blog/2008/12/07/genetic-programming-evolution-of-mona-lisa/?share=google-plus-1 "Click to share on Google+")
Google
- [](https://rogerjohansson.blog/2008/12/07/genetic-programming-evolution-of-mona-lisa/?share=linkedin "Click to share on LinkedIn")
LinkedIn
- [](#)
More
-
<!-- end list -->
- [](https://rogerjohansson.blog/2008/12/07/genetic-programming-evolution-of-mona-lisa/#print "Click to print")
Print
- [](https://rogerjohansson.blog/2008/12/07/genetic-programming-evolution-of-mona-lisa/?share=email "Click to email")
Email
-
-
### Like this:
Like
Loading...
### Related