Polygonal Approximation

The purpose of this project was to illustrate advanced programming, and particularly the use of genetic algorithms to solve complex problems. We had to load an image, to let the user select any shape displayed, and find the polygon which could represent the selected shape the best. In other words, if you load an apple photo, and select “5” to be the number of vertice for your polygon, the system had to draw an “apple looking” polygon. It sounds easy with simple shapes, but becomes quite tough with complex ones.

Maybe It’s better to see for yourself. In order to run the genetic process, run the app, load an image (shapes.jpg is quite good to illustrate the project) click on “Image>Projet IN*”. Select “polygon” for the “mode”, enter 5 for “Nb Polygons”, and click on ok. Then click on any shape of the image and watch the result. If you use the mid-button of your mouse, you’ll display the different results from the algorithm. (the first being the best). You can try again with different images or settings. The fitness parameter is particularly useful: It allows the function to blend a perimeter calculation with a surface function.


Leave a Reply

Your email address will not be published. Required fields are marked *