hash_distance — IMGFORENSICS hash op

Data kinds: phash × phashmeasurement

Call: import imgforensics; imgforensics.hash_distance(hash1, hash2) -> 'int' (or opsimgforensics.get("hash_distance"))

Usage

Hamming distance between two perceptual hashes (the number of differing bits).

> The detailed description below is the original text — the summary and the headings are translated.

dtype と長さを検査して fail-closed する。float の 1-D を受け取って

`!=` で数えると、ほぼ確実に「全ビット違う」= 最大距離という

*もっともらしい* 値が出る —— それは型の取り違えであって画像の違いではない。

返りは Python の `int(measurement` 語彙)。ビット長で割った

正規化距離が欲しければ `hash_distance(a, b) / a.size`。

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

• The canonical algorithm (author, year) and its uses are named in the family usage guide above.

Runnable examples (verified samples that actually call this op)

image_forensics_auditpy -3.11 examples/image_forensics_audit.py

Ops the type connects to (they accept measurement as input)

evidence_quantile

Same category (hash)

perceptual_hash


*Provenance: imgforensics.py — IMGFORENSICS operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.