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.
One Reply to “genetic algorithm for line drawings”