ICR OCR, tested on 24 hand printed forms
40 to 157
docTR fields right: lines in, then ink boxes
ICR reads one letter a box
ICR, intelligent character recognition, reads hand printed capitals on forms.
I made 24 boxed forms of 8 fields, in 3 sets:
- 8 in real hand print, from EMNIST.
- 8 in Patrick Hand and 8 in Caveat, two handwriting fonts.
- Values made up, scans simulated.
Tesseract, docTR and Apple Vision got the whole page, then each field cut out alone.
Box lines are the trap
To Tesseract, a row of empty boxes looks like a word made of I's. On the whole page (psm 3) it found 5 of 192 fields, two by luck.
- It printed 190 | characters on the 24 whole pages.
- On the box row alone, docTR read the walls as extra I and 1 in 85 fields. TrOCR made up years and words: "Dana 1951".
Clean crops lift every reader
| Reader | Box lines in | Lines out, ink boxes only |
|---|---|---|
| Tesseract, psm 7 | 10 | 50 |
| TrOCR base | 48 | 116 |
| docTR | 40 | 157 |
| Apple Vision | 122 | 160 |
- Lines out: each box's inside only, side by side on white.
- Left in, empty boxes became words: TrOCR read "Huang ching". Skipping them added 27 fields for TrOCR, 38 for docTR.
- Tesseract one box at a time got 17: it returned nothing for 457 of 1,241 inked boxes.
Real hand print is harder than fonts
| Way | EMNIST, of 64 | Fonts, of 128 |
|---|---|---|
| Apple Vision, ink boxes | 41 | 119 |
| docTR, ink boxes | 35 | 122 |
| TrOCR, ink boxes | 29 | 87 |
| docTR, whole page, found in text | 27 | 96 |
EMNIST is real hand print from NIST Special Database 19 (Cohen et al. 2017). I cropped, scaled, turned and boxed each character.
Some capitals look lowercase: e01's state MT came back "m7" from docTR and Apple Vision. Fonts are renders: one glyph per letter.
Our Actor, with no setup: 88 of 192
PDF OCR to Markdown, our Apify Actor, reads the whole page. Build 0.1.145, run on this Mac:
| Reader | Forms | Found |
|---|---|---|
| RapidOCR | 15 | 83 of 120 |
| Tesseract | 9 | 5 of 72 |
- All 5 Tesseract hits are the 2-letter state, 2 of them luck: MI in a garbled AMARILLO, MT in the phone row.
- A value found anywhere in the page text counts, so these are upper bounds.
Our Actor, hand printed digits: 2 of 24
| Kind | EMNIST | Fonts |
|---|---|---|
| Letters | 14 of 32 | 37 of 64 |
| Digits | 2 of 24 | 28 of 48 |
| ID, letters and digits | 0 of 8 | 7 of 16 |
Its worst fields: date of birth and ID, 7 of 24 each.
With the gaps between boxes left in, it found 67 fields, not 88.
Do it yourself: the zonal recipe
- Register: find the 4 corner marks, then warp the scan onto the template.
- Crop each field's box row by the template.
- Remove the walls: keep each box's inside, 6 px in from the center of the wall line.
- Skip empty boxes: under 40 pixels darker than 160 means no character.
- Read the strip, then drop characters outside the field's set: letters, digits or both.
Registration was off by 0.98 px at most.
Step 5 took TrOCR from 116 to 155 fields: it prints dots and words.
The bench code (45 lines)
import cv2
import numpy as np
IN = 6 # inside of a box: this many px in from the center of the wall line
EMPTY_DARK, EMPTY_MIN = 160, 40
def register(g):
"""Template-to-scan affine from the 4 corner marks, least squares."""
_, _, stats, cent = cv2.connectedComponentsWithStats(
(g < 100).astype(np.uint8), connectivity=8
)
src, dst = [], []
for x0, y0, x1, y1 in LAY["marks"]:
e = np.array([(x0 + x1) / 2, (y0 + y1) / 2])
ok = [
i
for i, (x, y, w, h, a) in enumerate(stats)
if i and 30 <= w <= 52 and 30 <= h <= 52 and a > 0.8 * w * h
]
i = min(ok, key=lambda i: np.hypot(*(cent[i] - e)))
assert np.hypot(*(cent[i] - e)) < 150
src.append(e)
dst.append(cent[i])
X = np.hstack([np.array(src), np.ones((4, 1))])
A = np.linalg.lstsq(X, np.array(dst), rcond=None)[0].T # 2x3
W, H = LAY["size"]
return A, cv2.warpAffine(
g, A, (W, H), flags=cv2.INTER_LINEAR | cv2.WARP_INVERSE_MAP, borderValue=255
)
def inside(a, b):
x0, y0, x1, y1 = b
return a[y0 + IN : y1 - IN, x0 + IN : x1 - IN]
def strip(ins):
"""Box insides side by side on white: 10 px gap, 20 px margin."""
h, w = ins[0].shape
s = np.full((h + 40, 20 + len(ins) * (w + 10) + 10), 255, np.uint8)
for i, im in enumerate(ins):
s[20 : 20 + h, 20 + i * (w + 10) : 20 + i * (w + 10) + w] = im
return s
LAY is the form template: the page size, the corner marks and each
field's boxes, in pixels. The ink test is one line in cut():
(im < EMPTY_DARK).sum() >= EMPTY_MIN.
What this test does not show
- Real forms: I drew one form and simulated the scan, so I knew every box. Real ICR needs a template per form.
- Dropout color: many ICR forms print boxes in a color scanners drop. Mine were black.
- One writer a form: each EMNIST character has a random writer, scaled up from 28 x 28 pixels.
- A second set: I added the ink-box ways and the character mask after the first results on these same 24 forms. No other forms checked them.
- Size: 192 fields, so a few fields apart is noise.
How I tested
- Forms: US Letter at 300 dpi, one character a box.
- Boxes 70 x 90 px, black walls 3 px wide.
- Fields: last name, first name, date of birth, city, state, ZIP code, phone, and an ID of 2 letters and 7 digits.
- Values: made up from lists of common first names and surnames, not real people.
- Each character scaled to 55 to 66 px high, and turned up to 6 degrees.
- Scan: a simulated gray flatbed scan, saved as JPEG.
- Whole page: Tesseract 5.5.4 (psm 3 and psm 11), Apple Vision, docTR defaults, and our Actor's own page code.
- Each field: Tesseract psm 7 with a whitelist, TrOCR base handwritten, docTR crnn_vgg16_bn, Apple Vision.
- Score: a field is right when the reading equals the value in capitals, spaces removed. On the whole page, when the value shows up anywhere in the text, with | also removed, so those are upper bounds.
- Speed, median a page: docTR on ink boxes 0.221 s, plus 0.082 s to register.
- TrOCR on ink boxes 12.357 s, our Actor 13.0 s.
- Tesseract, TrOCR and docTR on CPU, 2 threads (the Actor 1). Apple Vision ran as macOS chose. Apple M5 Max, macOS 26.6.
- Python 3.12, torch 2.15.0 and transformers 5.24.1.
- python-doctr 1.2.0 and OpenCV 5.1.0.
- Scripts and results stay in our private repo, in research/bench/icr-ocr-2026-11-26/.
Sources and credits
- Hand print: NIST Special Database 19, the source. Changed here: cropped, scaled, turned, placed in boxes and scanned by simulation.
- Via EMNIST, its ByClass test split.
- EMNIST: an extension of MNIST to handwritten letters, Cohen, Afshar, Tapson and van Schaik, 2017.
- Patrick Hand by Patrick Wagesreiter, SIL Open Font License 1.1.
- Caveat by The Caveat Project Authors, SIL Open Font License 1.1.
- TrOCR base handwritten, MIT license.
- docTR and Tesseract, Apache-2.0.
- Apple Vision, part of macOS.
- RapidOCR, Apache-2.0, inside our Actor.
- We make the Apify Actor, and none of the other tools here.
Questions people ask
What is ICR OCR?
ICR, intelligent character recognition, reads hand printed capitals on forms, one letter a box. The ICR way adds a form template: crop each field, remove the box lines, skip empty boxes, and keep only the field's characters.
Can Tesseract read hand printed forms?
Not on the whole page: it found 5 of 192 fields in our test, and read the box lines as I, L and |. Clean crops of each field helped, but docTR and Apple Vision did far better.
Which free reader did best?
Apple Vision, built into macOS, and docTR, free under Apache-2.0, both on clean crops of the boxes with ink. They read 160 and 157 of 192 fields.