Aug 28, 2012, 11:47 AM
Post #1 of 4
I'm working on a script which should evolve an approximation of the Mona Lisa, however it doesn't really work.
Evolving the Mona Lisa
Here is my script: http://pastebin.com/DJF2CNLD
Here's an overview of the functions:
generate_genes() - fills the arrays xchrom and ychrom with x and y coordinates, and the arrays r/g/b/achrom with rgba values
get_dimensions() - gets the width and height of the target image (ml.png)
initialise() - sets variables to correct starting values
draw_images() - creates 10 images using the values from the "genes"
score_images() - the score is the sum of the difference in the rgb values squared, lower scores are better
output_best() - called when a new best is found, prints the image to a png file
soft_mutate_x/y/r/g/b/a() - mutates the value by incrementing it by a random amount
Any suggestions for improvements to the script would be very much appreciated. Currently I'm running it on a picture of the Japanese flag, after 583 generations the resulting image looks nothing like the target image, and there hasn't been any further improvement for the last ~30 minutes.
Thank You :)
(This post was edited by Sam Kennedy on Aug 28, 2012, 11:50 AM)