code wiki / (root) / nx_silhouette_integrity.nx

nx_silhouette_integrity.nx

buildroot/runtime/nx_silhouette_integrity.nx

12680 B342 linesdepth 4pulls 4 transitivereach 4 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_silhouette_integrity.nx -- Tier 6 melty-edge detector. CAPABILITY_COMPLETENESS: FULL User feedback 2026-05-16 (image #5): "its a weird melty body and environment". AI image-gen fails this commonly: the body silhouette wavers / fuses into the background, limb-to-torso joints have no clear contour transition, fabric-to-skin boundaries blur instead of meeting at a sharp edge. Substrate's detector: - Given a segmented blob (from nx_segmenter_classical) and the source RGB image - For each pixel on the blob's PERIMETER (in-blob pixel with at least one out-of-blob neighbor): compute local Sobel gradient magnitude on luminance - Strong gradient = sharp edge; weak = melty - Score = fraction of perimeter pixels above NX_SILH_STRONG_Q10 - Sealed verdict SHARP / SOFT / MELTED / NO_PERIMETER Composes: nx_segmenter_classical (provides label_map + blob bbox) inline BT.601 luminance + Sobel 3x3 gradient genealogy_id: substrate_silhouette_integrity_2026_05_16 lineage_id: tier_6_melty_detector_v1

dependencies 4 imports · 1 importers

nx_syscalls.nx nx_runtime.nx nx_tier.nx nx_segmenter_classical.nx nx_silhouette_integrity.nx nx_image_grade_v2.nx

imports: nx_syscalls.nxnx_runtime.nxnx_tier.nxnx_segmenter_classical.nx

imported by: nx_image_grade_v2.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap _silh_fill_rgb_rect nx_segmenter_connected sys_mmap ↻ _seg_union _seg_find_root _seg_find_root ↻ nx_segmenter_largest_blob nx_silhouette_integrity sys_mmap ↻ _silh_sobel_at _silh_luma_u8

structs

66struct NxSilhouetteResult

consts

38const NX_MAGIC_1024: i64 = 1024
40const NX_SILH_Q10: nx_int = 1024
43const NX_SILH_VERDICT_SHARP: nx_int = 0 // most perimeter pixels strong
44const NX_SILH_VERDICT_SOFT: nx_int = 1 // moderate
45const NX_SILH_VERDICT_MELTED: nx_int = 2 // most weak; AI tell
46const NX_SILH_VERDICT_NO_PERIMETER: nx_int = 3 // blob too small / no border
54const NX_SILH_STRONG_RAW: nx_int = 60 // strong edge raw threshold
55const NX_SILH_WEAK_RAW: nx_int = 20
58const NX_SILH_THR_SHARP_Q10: nx_int = 700 // >= 0.68 strong
59const NX_SILH_THR_SOFT_Q10: nx_int = 400 // >= 0.39 strong
62const NX_SILH_MAX_DIM: nx_int = 8192
77const NX_SILH_RESULT_BYTES: nx_size = 64

functions

81func _silh_luma_u8(pixels: *u8, off: nx_int, bpp: nx_int, n_ch: nx_int) -> nx_int
called by 1: _silh_sobel_at
95func _silh_sobel_at(pixels: *u8, x: nx_int, y: nx_int,
136func nx_silhouette_integrity(
243func _silh_fill_rgb_rect(pixels: *u8, w: nx_int, bpp: nx_int,
called by 1: main
261func main() -> nx_int