# RECOGNIZE - native ISQL perceptual-image matching

This page calls the new native `RECOGNIZE` SQL command directly (not an ICPP-level helper) - `RECOGNIZE photo FROM id_catalog WHERE image='...' AND match=0` - which runs inside ISQL's own engine: it decodes each catalog row's real uploaded image bytes (a `storage`-type field), computes an average-hash (aHash) perceptual fingerprint for both the query image and every candidate, and returns every row with its percent match. This is genuine visual-similarity matching (a resized/recompressed copy of a catalog image still scores highly), not byte-level fingerprinting - unlike the older image_match.icpp.html demo, which is explicit that it does NOT do this.

## Catalog (real images, uploaded into ISQL's storage field)

id | name | image
--- | --- | ---
| ", icpp_sql_get($q,"id"), " | ", icpp_sql_get($q,"name"), " | "); } icpp_sql_free($q); ?>

## Try it

Pick a query image (server-side path - no upload widget yet, see WEBSUPPORT_ICPP_PLAN.md Part 6/9 for where that lands):

- query_resized.png (a resized copy of dog.png - different bytes/file size entirely, real visual-similarity test)
- query_exact.png (byte-identical to dog.png - sanity check, should score 100%)

RECOGNIZE result for: ", icpp_getparam("query_path"), ""); iprint("

id | name | match percent
--- | --- | ---
"); $m = icpp_sql_query($db, icpp_concat("recognize photo from id_catalog where image='", icpp_getparam("query_path"), "' and match=0;")); while(icpp_sql_next($m)) { iprint("
", icpp_sql_get($m,"id"), " | ", icpp_sql_get($m,"name"), " | ", icpp_sql_get($m,"MATCH_PERCENT"), "%
"); } iprint("

"); icpp_sql_free($m); icpp_sql_disconnect($db); ?>