My first attempt was to use OCR, but I was unable to get satisfying results quickly. However, I keep the code here for future reference, in case someone (even myself) might find it useful.