/PolyPic

An exploration of optimization techniques to reproduce images by the use of polygons.

Primary LanguagePythonMIT LicenseMIT

PolyPic

MIT Licence

An exploration of optimization techniques to reproduce images by the use of polygons.

Inspired on the cool work done by Michael Fogleman.

How it works

A target image is provided as input. Then, a source image is created by drawing a random set of translucent simple shapes in a black canvas. Finally, we run different optimization schemes to minimize the dissimilarity between source and target images, producing the artistic-ish abstract picture approximation.

The goal of the optimization routines explored is to modify parameters of the shapes in source image, such as the color or geometric attributes, in order to reduce the overall squared difference of pixel intensities with respect to the target image.

Three routines were considered and implemented to tackle this problem:

  • Genetic Algorithm
  • Simulated Annealing
  • Hill Climbing

Results

By using just 60 translucent simple shapes (circles, ellipses and triangles, respectively) we recreate the well-known artwork.

Examples