I needed a program that could read in an image and automatically identify closed-form shapes within it. This type of program would allow me to input an image of a face and extract all the individual features, for example.
To do so, I implemented a program for contour-finding. My Contour Finding program implements OpenCV’s findcontours function, which identifies potential continuous curve segments. The largest identified contour is labeled as the facial outline and eliminated. Each remaining contour is used to calculate a bounding box.
Then, the program implements a version of non-max suppression to find the four largest, separate bounding boxes in the image, corresponding to the four facial features (two eyes, nose, mouth). The identified features are output as cropped pngs that can then be vectorized and fed into the rest of the pipeline.
This program was implemented with my classifier and animator to produce a program that can animate input drawings.