Visualization of earthquakes in the San Francisco Bay Area. Grey value indicates the magnitude of the most recent quake (top), all quakes in the past 24 hrs (bottom), and max quake each day for the past 30 days (middle).

Made using a Raspberry Pi Zero W and a Pimoroni Inky wHAT, mounted in an 8 inch square frame.

genetic algorithm for line drawings

These drawings were extracted from images using a combination of OpenCV and a genetic algorithm.

First, OpenCV is used to find contour lines and canny edges in the images. On the left are all the lines found this way (typically hundreds of lines) that have been post-processed a bit to smooth longer lines.

On the right are 20 lines selected by the genetic algorithm. The algorithm generates 100 drawings, each with a different set of lines from the drawing on the left. It then automatically evaluates the fitness of each drawing and creates a new generation of 100 drawing, selecting characteristics more often from the highest rated drawings and tossing in some random mutations.

The goal is to capture the essence of the original image in just a few vector lines so that a drawing robot can efficiently recreate it. Below are more examples.