When technology and art combine, that is when society gets truly pushed forward. Andy Warhol pioneered the technique of leveraging technology to produce art _en masse_ to force consideration of what art even means, so I intend to continue this mission and reduce the meaning in art even more.
This script takes in a regular image and produces a high-quality, carefully thought-out portrait. It's abstract, which packs even more meaning into the image while I put even less thought into it.
Sometimes it gets too abstract, so you can pass in a command line flag to label things in the image for you so you can still tell what they are.
How it works
Using OpenCV, edge detection and filtering is used to distill a photo into a line drawing. In regions where a face is detected, lines are allowed to be finer, whereas in areas with just background, coarser lines are preferred.
Then, the edge contours are refined to an ordered set of points. A cubic spline is fitted through these points, with a high enough tightness that the line bulges out in parts and doesn't follow exactly. The line is coloured based on the average colour of the area the contour surrounds.
YOLO, an object detector and classifier network, is run on the original image. If recognizable objects are present in the original image (e.g. a person), then the label is whimsically added to the portrait with an arrow pointing to the region of the detected object.
Install darknet as per the instructions on the Node YOLO bindings readme.
curl -L http://pjreddie.com/media/files/yolo.weights > yolo.weights yarn install
Run the script
node index.js adam.jpg && open out.jpg node index.js andrew3.jpg true && open out.jpg