Generating Image with Genetic Algorithm

preview_player
Показать описание
I used a genetic algorithm to produce an image that is the closest fit to a goal image. The way the algorithm works is that it creates a population of images where the pixels are randomized. It then calculates the fitness for each individual in the population and sorts them from lowest to higher (lowest in this case being the best). It then mutates the bottom 75% of images by randomizing a certain number of pixels. It then re-sorts them according the fitness and the process continues.

After a certain number of generations, the image with the lowest fitness is the one outputted to a new file which is the final image.

To make the video, I outputted a new picture every 100 fitness, then ran a bash script to convert them all to .jpg's, then made a short video out of it!

Enjoy!
Рекомендации по теме