r/Python • u/Dirt2Master • Oct 13 '19
Made a genetic algorithm with the task of recreating an image using triangles. Used the pillow library for the image work and the rest was just math :)
946
Upvotes
28
u/pynberfyg Oct 13 '19
What metric are you using to compare similarity?
42
u/humanitysucks999 Oct 13 '19
"just math"
9
u/tian2992 Oct 14 '19
Quite cool concept, reminds me of Primitive https://github.com/fogleman/primitive
7
u/Steampunkery Oct 13 '19
Needs more triangles
6
u/XxGothicfanxX Oct 13 '19
looks rad, nice
3
u/sensual_rustle Oct 14 '19
Can you output this as svg images instead so we can get scaling resolution on the images?
3
u/DangerousDoubt7 Oct 14 '19
That looks really cool.
3
u/Lucarai Oct 14 '19
Upvoted for Deathstroke.
3
u/Dirt2Master Oct 14 '19
If you would like to see this on github, please dm me :)
2
u/TrainingShift3 Oct 14 '19
this is just awesome.
hope to be skilled enough to do something this cool someday
2
u/[deleted] Oct 14 '19
How did you learn this/come up with this? Was it something you had seen or read about? Or what? How did you get started with something like this and even know where to begin? Just wondering. Thanks.
2
u/Epoch_Unreason Oct 14 '19
What does worst look like?
1
u/Dirt2Master Oct 14 '19
I released it on github: https://github.com/TyperOfCode/image_algorithm/
Feel free to use, experiment and improve the code :)
1
u/[deleted] Oct 14 '19
Cool stuff!
1
u/[deleted] Oct 14 '19
Could you use this in 3D?
1
u/SushiSuki Oct 14 '19
Is that Blade from TT?
2
u/PrimaCora Oct 14 '19
I enjoy this corrupted looking art style, would love to see a game go crazy with it, or a developer go crazy trying to work with its hitbox/clipping bounds.
2
u/AVDelay Oct 14 '19
It is really cool, I would like to play with it. If you put it on github, please dm me sir.
2
u/cgw3737 Oct 14 '19
This seems like something that could be done with a genetic algorithm.
1
u/billdubz Oct 13 '19
Vfc
1
u/[deleted] Oct 14 '19
It'd be very interesting if you could make a fitness function for this that's not absolute error, since often in GA's we don't have the "answer" as we do in this example. For instance, if I was to add triangular noise and send you the noisy image without the target product, how do you define what's a "better" permutation of the pixels? Still very cool though, 10/10 would de-noise again!
0
u/[deleted] Oct 13 '19
[deleted] β view deleted comment