Approximating images using random shapes with random attributes and evolution aspects.
Specifically inspired by Spu7Nix Geometry Dash image algorithm video (Link here to timelapse) but I'm sure other similar filters exist.
As a challenge, this is created from scratch in Python 3.10.1 primarily using Pillow without examining other attempts
Utilizes testing and logging and Abstract Classes.
- Color Difference Map between canvas and target
- Generate n random shapes with random attributes
- colors based on average value of target image at position
- Calculate score based on Color Difference Map with and without shape for each shape added
- Rank best shapes
- If max iterations or hit threshold of improvement of image, go to step 9
- Keep subset of best shapes
- Generate children of best shapes using small tweaks to attributes
- While iterating, Go to step 2
- Once found, apply best shape to image
- If max iterations or hit threshold of similarity between canvas and target, complete. Otherwise go to step 1
Sample: initial image | Brute Force (no evolution) | Refined Settings