What principles to use, in order to create field that will be read by OCR? I currently have an invoice, where some numbers are written by hand, and I would need to read them automatically.

My past experience is that people who write numbers will them write in so many different ways (overlapping with field name etc.) that it's really hard to isolate only digits.

Now I would like to redesign invoice, for example, to add field of some rectangular shape, that will be easily detectable (think easy to detect like a QR code is).

I'm not sure:

should I add some ordinary box, or are there any specific designs of fields/boxes/rectangles that would make finding the field and isolating everything in it (from image) simple and 99% correct?

Tech stack that would be used is:


OpenCV
Python
HTML/CSS for creating the design of invoice, that would be exported to pdf for users to fill it with the needed information
There's been forms like that forever: In Germany, the Überweisung (wire transfer) / Verrechnungsscheck (Cheque for accounting) have always been on things like this:

Link

and as far as I can tell, that works pretty well with 1990's tech.

Note how the boxes are part of the "background" and are color-wise probably designed to simply disappear in a first processing step after scanning.

However, while that might be have been at a different level of initial investment, postal services find and read postal codes / ZIP numbers that are handwritten since at least the mid-nineties, so: Yeah, bummer that people aren't good OCR-compatible writers, but maybe your OCR just has to get better: Knowing that you're only looking for numbers will help a lot. Don't take an OpenCV example as a complete OCR solution. There's more to OCR than segmenting individual glyphs and trying to find the closest match to each one from an alphabet in isolation.