code wiki / (root) / nx_img_segment.nx

nx_img_segment.nx

buildroot/runtime/nx_img_segment.nx

3861 B74 linesdepth 4pulls 4 transitivereach 3 importersview sourcekind librarytopic img
docsdependenciesstructsconstsfunctions

about

nx_img_segment.nx -- R3 of the sovereign scanning stack: binary image -> connected components (glyph boxes). 8-connected component labeling by iterative flood-fill (explicit stack, no recursion), accumulating each component's bounding box as it grows. Ink = 0, paper = 255 (the R2 binarization convention). Each component is a candidate glyph/mark that R4 (OCR classify) will recognize. Integer-exact, zero deps. license_tier: ORIGINAL

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_img_threshold.nx nx_img_segment.nx nx_garment_lib.nx nx_img_segment_gate.nx

imports: nx_syscalls.nxnx_img_threshold.nx

imported by: nx_garment_lib.nxnx_img_segment_gate.nx

structs

none

consts

8const SEG_BOXF: i64 = 4 // per box: [minx, miny, maxx, maxy]

functions

12func seg_components(pix: *u8, w: i64, h: i64, labels: *i64, boxes: *i64, maxcomps: i64) -> i64
69func seg_box_minx(boxes: *i64, id: i64) -> i64 { return boxes[(id-1)*SEG_BOXF+0] }
called by 1: main
70func seg_box_miny(boxes: *i64, id: i64) -> i64 { return boxes[(id-1)*SEG_BOXF+1] }
called by 1: main
71func seg_box_maxx(boxes: *i64, id: i64) -> i64 { return boxes[(id-1)*SEG_BOXF+2] }
called by 1: main
72func seg_box_maxy(boxes: *i64, id: i64) -> i64 { return boxes[(id-1)*SEG_BOXF+3] }
called by 1: main
73func seg_box_width(boxes: *i64, id: i64) -> i64 { return boxes[(id-1)*SEG_BOXF+2] - boxes[(id-1)*SEG_BOXF+0] + 1 }
called by 1: main
74func seg_box_height(boxes: *i64, id: i64) -> i64 { return boxes[(id-1)*SEG_BOXF+3] - boxes[(id-1)*SEG_BOXF+1] + 1 }
called by 1: main