fontezuma

This was the final project for a computer vision course in my master’s program.

If you have an image that includes text, you can feed it into this program and it tells you which font that text most likely is. More accurately, it tells you which of the fonts in the training set are most similar to the image text.

It works in three stages. First it builds its own training data: it walks a directory of .ttf files and renders every letter and digit of every font to a 200x200 grayscale image, so each font becomes a folder of labelled glyphs. Then it trains a CNN (TensorFlow/Keras) on those images, with one class per font. Finally, given a real image, it uses OpenCV to pull the individual characters out - CLAHE to even out the contrast, Otsu thresholding to get a clean black-and-white image, contour detection to find the character boundaries - classifies each character separately, and aggregates those per-character scores into a single prediction for the image as a whole.

See it here on GitHub.

← Back to Projects