Skip to content

Windows OCR: read large pages in tiles, at size and enlarged, for Redact and Copy Text - #368

Merged
danjboyd merged 2 commits into
mainfrom
ocr-tiled-windows
Nov 9, 2026
Merged

danjboyd merged 2 commits into
mainfrom
ocr-tiled-windows

Conversation

@danjboyd

@danjboyd danjboyd commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Windows OCR for Redact and Copy Text now reads large pages in tiles, at their own size and enlarged, so small text on 4K captures is found reliably. This is the Windows counterpart of #367, which covers Linux/tesseract.

What changes

  • Above 1600 px, Windows.Media.Ocr reads the page in the same tiles the Vision path uses. Read whole, a large page can lose most of its text, unpredictably.
  • Each tile, or a smaller image read whole, is read twice: at its own size, and enlarged 2x with WIC's Cubic filter. The readings are then merged.
  • Where two readings of a word disagree, the merge keeps the one the matcher recognizes. Without that rule, coverage is 76%.
  • Two readings of the same region keep the first reading's line order, so a column stays together. Main's column ordering then applies.
  • Tests: TextRecognizerProbe_test.m covers the merge.

Results (Windows 11, 100% scale)

  • Coverage: on 13 text-dense 4K captures, Redact now covers 87% of items, up from 59% before this change. It makes one false rect across all 13 pages, on a date. It takes about 5.5–6 s a page.

  • In-app check of c91498b, through Copy Text and Redact:

    Page Redact covered Time
    l14, a 4K text page 222/222 8.9 s
    Two-column page 24/24 3.3 s

    Copy Text's output matched the test harness output exactly.

  • Test suite: everything passes except the existing title test. It fails on Windows because GNUstep reads the Windows time zone as GMT, which is unrelated to this change; a local test-only fix exists.

Known limit: grey 11 px text

Small grey text, 11 px grey on white, is still only partly covered. On that page Redact drew 176 rects for 270 items. The harness counted 153 of the 270 as fully covered. So Redact can still miss parts of very small, low-contrast text on Windows, and users should check redactions of such text by eye.

Branch head: c91498b on a41c9dd.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AEr1tY2QmxWFSoDkDHs2DC

danjboyd and others added 2 commits November 6, 2026 14:55
A large page read whole can lose most of its text, unpredictably, so above
1600 px Windows now reads in the tiles Vision uses. Each tile, or a smaller
image whole, is read at its size and enlarged twice over with WIC's Fant, and
the readings are merged. On 13 text-dense 4K captures, items Redact covers go
from 59% to 84%, with no false rects, at about 4.6 s a page.

When readings of a word disagree, the merge keeps the one the matcher
recognizes; without that the recall was 76%. Two readings of one region keep
the first's line order, so a column stays together.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With the date rules in, Cubic covers 87% of the items on the 13 captures to
Fant's 84%, at about 5.5 s a page. One false rect in the 13 pages, on a date.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@danjboyd
danjboyd merged commit 4bdb641 into main Nov 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant