code wiki / (root) / nx_img_threshold.nx

nx_img_threshold.nx

buildroot/runtime/nx_img_threshold.nx

2025 B52 linesdepth 3pulls 3 transitivereach 5 importersview sourcekind librarytopic img
docsdependenciesstructsconstsfunctions

about

nx_img_threshold.nx -- R2 of the sovereign scanning stack: grayscale -> binary (ink/paper). Otsu's method finds the intensity threshold that maximizes between-class variance (the optimal split of a bimodal page histogram), then binarizes to 0 (ink) / 255 (paper). Integer-exact (integer class means; no floats). Composes R1's img_histogram. This is what turns a scanned page into clean text-vs-background for R3 segmentation. license_tier: ORIGINAL

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_img_core.nx nx_img_threshold.nx nx_img_segment.nx nx_img_threshold_gate.nx

imports: nx_syscalls.nxnx_img_core.nx

imported by: nx_img_segment.nxnx_img_threshold_gate.nx

structs

none

consts

none

functions

9func thr_otsu(hist: *i64, npix: i64) -> i64
called by 1: thr_otsu_of
37func thr_otsu_of(pix: *u8, npix: i64) -> i64
called by 1: main calls 3: sys_mmapimg_histogramthr_otsu
44func thr_binarize(pix: *u8, npix: i64, t: i64) -> i64
called by 1: main