nx_silhouette_integrity.nx
buildroot/runtime/nx_silhouette_integrity.nx
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
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
structs
| 66 | struct NxSilhouetteResult |
consts
| 38 | const NX_MAGIC_1024: i64 = 1024 |
| 40 | const NX_SILH_Q10: nx_int = 1024 |
| 43 | const NX_SILH_VERDICT_SHARP: nx_int = 0 // most perimeter pixels strong |
| 44 | const NX_SILH_VERDICT_SOFT: nx_int = 1 // moderate |
| 45 | const NX_SILH_VERDICT_MELTED: nx_int = 2 // most weak; AI tell |
| 46 | const NX_SILH_VERDICT_NO_PERIMETER: nx_int = 3 // blob too small / no border |
| 54 | const NX_SILH_STRONG_RAW: nx_int = 60 // strong edge raw threshold |
| 55 | const NX_SILH_WEAK_RAW: nx_int = 20 |
| 58 | const NX_SILH_THR_SHARP_Q10: nx_int = 700 // >= 0.68 strong |
| 59 | const NX_SILH_THR_SOFT_Q10: nx_int = 400 // >= 0.39 strong |
| 62 | const NX_SILH_MAX_DIM: nx_int = 8192 |
| 77 | const NX_SILH_RESULT_BYTES: nx_size = 64 |
functions
| 81 | func _silh_luma_u8(pixels: *u8, off: nx_int, bpp: nx_int, n_ch: nx_int) -> nx_int called by 1: _silh_sobel_at |
| 95 | func _silh_sobel_at(pixels: *u8, x: nx_int, y: nx_int, |
| 136 | func nx_silhouette_integrity( |
| 243 | func _silh_fill_rgb_rect(pixels: *u8, w: nx_int, bpp: nx_int, called by 1: main |
| 261 | func main() -> nx_int |