Image Mutation

This project was a final assignment for my Principles of Programming class. This was done in C and helped further my understanding for pointers and memory allocation. Considering C is not object oriented, this assignment involved a large use of structures, hence, memory allocation and de-allocation was necessary. This assignment required the use of genetic algorithm in order to display an image that resembled the target image.

This algorithm worked by creating a population of images in which each entity of that population has randomized pixels. Upon completion, the algorithm determines each individual entity's fitness and sorts the entire population from lowest to highest.

The algorithm then mutates the bottom 75% of the entities by furhter randomizing a number of pixels, then follows up by resorting the population. After a certain number of mutations, the algorithm will ouput the image with the lowest fitness to a new .ppm file.

The picture on the left is the target image, and the picture on the right is the picture produced by the genetic algorithm:

Target image mutated image

Second Target Second Mutated image

Here is what the process would look like from start to finish:


Gif of process

All source code is available upon request.

Contact Me

If you have any questions or inquiries feel free to contact me at: