Genetic Python plugin - faster draw and fill

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

maybe you have read about Roger Alsings "Evolution of Mona Lisa" ( http://rogeralsing.com/2008/12/07/genetic-programming-evolution-of-mona-lisa/ ). I am trying to write a plugin (script) for GIMP that does something like this. The plugin should create a lot (maybe 500000 to 1000000) generations of new images and try to resemble the original image as much as possible using only polygons(each generation consists of 1 to 10 images, and "dies" as soon as a new generation is born, so I dont plan on having a million images open at the same time ;).

Basically its working like I want - I can create new images, create a selection based on evolved points using gimp_free_select and fill the selection in the right color and opacity. And in the end I get something that looks like Roger Alsings Mona Lisa. ( http://sanguis-lunae.de/Uni/ml5-10000.bmp is what I get after 10000 generations)

But its slow. It takes 30 minutes for only 20000 generations. There are so many ways of doing this I cant try them all. So thats my question: What is a good ( the best?) way to draw about 50 shapes, each with 3 - 10 points (I only use polygons, but I might try circles, brush strokes or something else later) over and over again and then compare it to a given image?

My ideas so far:
Simple but slow:
create new image 
gimp_free_select to make a selection from a list of points
set_foreground to choose a color
edit_bucket_fill to fill selection
copy "goal" image to new layer in this image
set layer to DIFFERENCE mode
merge
read mean value from histogram (this indicates how similar the two layers were ( zero would be perfect)
mutate a copy of the polygon image (slightly alter one of the polygons, all other stay the same) and repeat

or a second idea:
my algorithm only changes one polygon in each new image, so I often draw the same shapes over and over again:
create a new layer for each shape
bucketfill shapes on their layers
merge all 50 layers
reuse layers for next generations
and so on
problem: merging takes a lot of time and the original 50 layers are lost if I dont copy them to a new image before merging, so its just as fast as my first idea

And I thought of using path objects for my polygons, but these have to be converted to selections anyway, as they cant be bucketfilled?


But maybe there is a much better way?

Frederik
-- 
GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate und Telefonanschluss
für nur 17,95 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02
_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux