nx_img_segment.nx
buildroot/runtime/nx_img_segment.nx
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
imports: nx_syscalls.nxnx_img_threshold.nx
imported by: nx_garment_lib.nxnx_img_segment_gate.nx
structs
| none |
consts
| 8 | const SEG_BOXF: i64 = 4 // per box: [minx, miny, maxx, maxy] |
functions
| 12 | func seg_components(pix: *u8, w: i64, h: i64, labels: *i64, boxes: *i64, maxcomps: i64) -> i64 called by 5: gm_segment_dilategm_segment_multimodalgm_segment_noskingm_segment_satmain calls 1: sys_mmap |
| 69 | func seg_box_minx(boxes: *i64, id: i64) -> i64 { return boxes[(id-1)*SEG_BOXF+0] } called by 1: main |
| 70 | func seg_box_miny(boxes: *i64, id: i64) -> i64 { return boxes[(id-1)*SEG_BOXF+1] } called by 1: main |
| 71 | func seg_box_maxx(boxes: *i64, id: i64) -> i64 { return boxes[(id-1)*SEG_BOXF+2] } called by 1: main |
| 72 | func seg_box_maxy(boxes: *i64, id: i64) -> i64 { return boxes[(id-1)*SEG_BOXF+3] } called by 1: main |
| 73 | func 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 |
| 74 | func 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 |