Using genetic algorithms to reconstruct images
As we discussed previously, our goal in this experiment is to use a familiar image as a reference and create a second image, as similar as possible to the reference, using a collection of overlapping polygons of varying colors and transparencies. Using the genetic algorithms approach, each candidate solution is a set of such polygons, and evaluating the solution is carried out by creating an image using these polygons and comparing it to the reference image.
As usual, the first decision we need to make is how these solutions are represented. We will discuss this in the next subsection.
Solution representation and evaluation
As we mentioned previously, our solution consists of a set of polygons within the image boundaries. Each polygon has its own color and transparency. Drawing such a polygon using the Pillow library requires the following arguments:
- A list of tuple, [(x 1, y 1), (x 2, y 2), …...