MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINEMACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE

CARICATURE MACHINE


For Machine Week, the Harvard Section made a Caricature Drawing machine and application. I led the software team and wrote the entire Caricature app that distorts given images by exaggerating facial features. The app uses a face detection model to detect and map landmarks onto facial features, and then distorts prescribed features by either exploding or imploding the region and then blurring the affected feature back into the original image.



STEP 1: LANDMARK DETECTION


  • First we use a shape predictor model trained to detect 68 landmarks on key features of a face: eyes, brows, nose, mouth, and jawline. In the code, I wrote these features as independent variables that can be manipulated separately in order to have more control over the caricature effect.






  • STEP 2: FEATURE MANIPULATION AND EDGE DETECTION


  • Once we have the coordinates for the independent features, we apply distortions to them (explosions to scale, and implosions to pinch). We then blur the isolated, manipulated features back into the original image in order to create a seamless caricature effect.


  • Now we can create basic caricatures, but in order to communicate with the machine, we need to take our image and turn it into a set of points that can be sent to our machine. To do this, edge detection is our friend. We first create a blurred, grayscale image of the Caricature, and then apply a Canny edge detection filter to it. From the edge silhouette, we translate the contours into a set of points with x, y coordinates.


  • This is how we draw Alien Obama!




  • MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINEMACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE/MACHINE