nx_visdesc.nx
buildroot/runtime/nx_visdesc.nx
about
nx_visdesc.nx -- GRAYSCALE VISUAL-SIMILARITY DESCRIPTOR (edge-orientation layout, integer).
The dHash/aHash engine (nx_phash) finds NEAR-COPIES (the same image, recompressed/rebrightened/
resized). It cannot find images that merely LOOK ALIKE -- two DIFFERENT photos with the same
composition, texture, or structure. This descriptor does: a 4x4 spatial grid of magnitude-weighted
edge-orientation histograms (MPEG-7 Edge-Histogram-Descriptor / GIST spatial-envelope lineage) plus
a brightness-normalised tone layout, packed into an 80-dim integer vector ranked by L1 distance.
"Google-lite" visual similarity -- structural/textural, NOT semantic object recognition (the trained
-CNN rung is separate). Integer + deterministic + zero-dep = the sovereign moat over float feature
extractors.
genealogy_id: manjunath_2001_mpeg7_ehd + oliva_torralba_2001_gist (spatial envelope)
composes: nx_image_sobel_x / nx_image_sobel_y / nx_image_s64_get -- the existing Sobel substrate
(ZERO new gradient math). license_tier: ORIGINAL
dependencies 1 imports · 4 importers
imports: nx_image.nx
imported by: nx_imgbench.nxnx_imgsearch_tier.nxnx_imgsig.nxnx_visdesc_gate.nx
structs
| none |
consts
| 16 | const VD_GRID: i64 = 4 // 4x4 spatial cells |
| 17 | const VD_CELL: i64 = 5 // per cell: 4 orientation bins + 1 relative-tone value |
| 18 | const VD_DIM: i64 = 80 // VD_GRID*VD_GRID*VD_CELL |
| 19 | const VD_OSCALE: i64 = 256 // each cell's orientation histogram normalised to this sum (contrast-invariant) |
| 20 | const VD_MAGTHRESH: i64 = 24 // gradient-magnitude noise floor (|gx|+|gy|); below = flat, ignored |
| 21 | const VD_TONEBIAS: i64 = 128 // tone stored as (cell_mean - global_mean) + bias, clamped 0..255 (brightness-invariant) |
functions
| 23 | func nx_visdesc_dim() -> i64 { return VD_DIM } |
| 26 | func vd_wrap_gray(gray: *u8, w: i64, h: i64) -> *Image |
| 38 | func vd_orient_bin(gx: i64, gy: i64) -> i64 called by 1: nx_visdesc_extract |
| 54 | func nx_visdesc_extract(gray: *u8, w: i64, h: i64, out: *i64) -> i64 |
| 134 | func nx_visdesc_l1(a: *i64, b: *i64) -> i64 |