code wiki / (root) / nx_ocr_classify.nx

nx_ocr_classify.nx

buildroot/runtime/nx_ocr_classify.nx

2115 B48 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind librarytopic ocr
docsdependenciesstructsconstsfunctions

about

nx_ocr_classify.nx -- R4 of the sovereign scanning stack: glyph box -> character. The recognition core: resample a segmented glyph (its bbox in the binary image) to a fixed GW x GH grid, then classify by NEAREST-NEIGHBOUR (minimum Hamming distance) against a template set. This is classical template-match OCR for MACHINE PRINT -- integer-exact, zero deps, no ML. Coverage/accuracy grows with the template set (later rungs); this rung proves the mechanism. R5 assembles recognised chars into text -> nx_money_ledger -> money-OS. license_tier: ORIGINAL

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_ocr_classify.nx nx_ocr_classify_gate.nx

imports: nx_syscalls.nx

imported by: nx_ocr_classify_gate.nx

structs

none

consts

none

functions

10func ocr_resample(pix: *u8, w: i64, minx: i64, miny: i64, bw: i64, bh: i64, gw: i64, gh: i64, cell: *i64) -> i64
called by 1: main
28func ocr_hamming(a: *i64, b: *i64, ncells: i64) -> i64
called by 2: ocr_classifymain
36func ocr_classify(cell: *i64, ncells: i64, templates: *i64, ntempl: i64, best_out: *i64) -> i64
called by 1: main calls 1: ocr_hamming