CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate: Evolving the Mona Lisa: Edit Log

Sam Kennedy

Aug 28, 2012, 11:47 AM

Views: 2081
Evolving the Mona Lisa

I'm working on a script which should evolve an approximation of the Mona Lisa, however it doesn't really work.

Here is my script:

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)

Edit Log:
Post edited by Sam Kennedy (Novice) on Aug 28, 2012, 11:50 AM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives