TSP art or travelling salesman problem art, is an image which can be drawn with one single line. If you draw it by hand you can use one single stroke without lifting your pencil.
Its an implementation of tsp art with genetics and nearest neighbor algorithms!
Lets start with my pic
First it takes an image as input and converts it to black & white image; then makes it pure black and white using a threshold, result is something like this
Then extracts some nodes from this pic ( reduces image quality using QUALITY parameter and then every black pixel is a node, and add some irregularity to it), this is the result
Now we have the graph, all we need is solve tsp on this graph, there is two method implemented, genetics and nearest neighbor, genetics isn't so good on large graphs and nearest neighbor works better; here is the result
python nearest_neighbor.py img.jpg
opencv
numpy
matplotlib