nx_image_search.nx
buildroot/runtime/nx_image_search.nx
about
nx_image_search.nx -- REUSABLE per-site SEARCH-BY-IMAGE (reverse-image) CLIENT.
ONE perceptual-hash engine pointed at ANY site via a data-driven sites registry (Cardinal 11/17).
Each site = its OWN durable fingerprint index, so a query is SCOPED to exactly that site BY
CONSTRUCTION (site A's index file physically cannot return site B's images). This is the image-side
analog of nx_onsite_search (which does text->doc); here we do image->image: "find this image across
THIS site's corpus", Yandex/Google/Bing reverse-image style, done sovereignly.
Usage: nx_image_search <sites.tsv> <site> <query_gray_path> <w> <h> [threshold]
Registry row (TAB-separated, trailing newline required): site<TAB>fp_index_path<TAB>base_url
fp_index line (built by nx_image_index / the gate; docid = line number):
cid<TAB>dhash_hex16<TAB>ahash_hex16
REUSE not reinvent: dHash/aHash + nearest-fingerprint + 64-bit Hamming all come from nx_phash
(Krawetz 2011 / Zauner 2010) -> ZERO new ranking math. The query image is a raw grayscale buffer
(w*h u8) so the client stays format-agnostic; the real-corpus path (PNG/JPEG decode -> gray) is a
separate ingestor rung. dHash ranks (robust to brightness/recompress/resize); aHash breaks ties.
HONEST: this is the FAST near-duplicate tier; semantic "looks-like" needs a trained embedding (later
rung). license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_phash.nxnx_itoa_lib.nxnx_image_gray.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 23 | const IS_TOP_K: i64 = 5 |
| 24 | const IS_DEFAULT_THRESH: i64 = 10 |
functions
| 26 | func is_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } called by 1: main |
| 27 | func is_putb(p: *u8, n: i64) -> i64 { if n>0 { sys_write(1,p,n) } return 0 } called by 1: main |
| 32 | func is_num(v: i64) -> i64 { nxi_out(v); return 0 } |
| 33 | func is_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 34 | func is_streq(a: *u8, b: *u8) -> i64 { var i: i64=0; while a[i]!=(0 as u8){ if a[i]!=b[i]{return 0} i=i+1 } if b[i]!=(0 as u8){return 0} return 1 } called by 1: is_lookup_site |
| 35 | func is_atoi(s: *u8) -> i64 { var v: i64=0; var i: i64=0; while s[i]!=(0 as u8){ if s[i]>=(48 as u8){ if s[i]<=(57 as u8){ v=v*10+((s[i]-(48 as u8)) as i64) } } i=i+1 } return v } called by 1: main |
| 38 | func is_hexparse(p: *u8) -> i64 called by 1: main |
| 54 | func is_lookup_site(reg: *u8, n: i64, site: *u8, out_idx: *i64, out_base: *i64) -> i64 |
| 85 | func main(argc: i64, argv: *i64) -> i64 |