Skip to main content

Module embeddings

Module embeddings 

Source
Expand description

Local CBIR proxy embeddings — specialized_libs::computer_vision::embeddings.

Modules§

color_hist_embed
Fixed-size RGB colour histogram → L2-normalized f32 embedding (caller buffer).
embed_distance
Distances for local visual embedding proxies (hash Hamming + float cosine).
perceptual_hash_u64
aHash / dHash perceptual hashes over a gray buffer.

Constants§

AHASH_SIDE
Side length for aHash (8×8 → 64 bits).
COLOR_HIST_BINS
Bins per RGB channel for the joint histogram.
COLOR_HIST_EMBED_DIM
Embedding dimension: joint 4×4×4 RGB histogram (64 floats).
DHASH_HEIGHT
DHASH_WIDTH
dHash samples (WIDTH+1)×HEIGHT so adjacent horizontal diffs yield 64 bits.

Functions§

ahash_u64
Average hash: nearest-neighbor sample to 8×8, bit = pixel ≥ mean.
color_hist_embed_rgb
Fill out[..COLOR_HIST_EMBED_DIM] with an L2-normalized joint RGB histogram.
cosine_distance
Cosine distance 1 − cosine_similarity (identical unit vectors → 0).
cosine_similarity
Cosine similarity dot(a,b) / (|a||b|) over equal-length slices.
dhash_u64
Difference hash: nearest-neighbor sample to 9×8, bit = right ≥ left (row-wise).
hamming_distance_u64
Popcount of XOR bits between two 64-bit perceptual hashes.