pub struct MultiHashFingerprint { /* private fields */ }Expand description
A multi-algorithm fingerprint containing hashes from multiple perceptual algorithms.
Provides enhanced similarity detection by combining results from multiple hash algorithms with weighted combination for improved accuracy.
Implementations§
Source§impl MultiHashFingerprint
impl MultiHashFingerprint
Sourcepub fn exact_hash(&self) -> &[u8; 32]
pub fn exact_hash(&self) -> &[u8; 32]
Returns the BLAKE3 hash of the original image bytes.
Sourcepub fn ahash(&self) -> &ImageFingerprint
pub fn ahash(&self) -> &ImageFingerprint
Returns the AHash-based fingerprint.
Sourcepub fn phash(&self) -> &ImageFingerprint
pub fn phash(&self) -> &ImageFingerprint
Returns the PHash-based fingerprint.
Sourcepub fn dhash(&self) -> &ImageFingerprint
pub fn dhash(&self) -> &ImageFingerprint
Returns the DHash-based fingerprint.
Sourcepub fn get(&self, algorithm: HashAlgorithm) -> &ImageFingerprint
pub fn get(&self, algorithm: HashAlgorithm) -> &ImageFingerprint
Returns the fingerprint for a specific algorithm.
Sourcepub fn compare(&self, other: &MultiHashFingerprint) -> Similarity
pub fn compare(&self, other: &MultiHashFingerprint) -> Similarity
Compares two multi-hash fingerprints using weighted combination.
Uses weighted combination of algorithm similarities:
- 10%
AHashsimilarity (average hash, fastest) - 60%
PHashsimilarity (DCT-based, robust to compression) - 30%
DHashsimilarity (gradient-based, good for structural changes)
Each algorithm’s similarity includes both global and block-level hashing for improved crop resistance. Block hashes are weighted at 60% and global hashes at 40% within each algorithm.
Uses the default block distance threshold of 32.
Use compare_with_threshold for custom thresholds.
Sourcepub fn compare_with_threshold(
&self,
other: &MultiHashFingerprint,
block_threshold: u32,
) -> Similarity
pub fn compare_with_threshold( &self, other: &MultiHashFingerprint, block_threshold: u32, ) -> Similarity
Compares two multi-hash fingerprints with a custom block distance threshold.
§Arguments
other- The fingerprint to compare againstblock_threshold- Maximum Hamming distance for a block to count as a match (0-64). Lower = stricter (fewer blocks qualify), higher = looser. Default is 32.
Sourcepub fn is_similar(&self, other: &MultiHashFingerprint, threshold: f32) -> bool
pub fn is_similar(&self, other: &MultiHashFingerprint, threshold: f32) -> bool
Checks if this fingerprint is similar to another within a threshold.
Uses the weighted combination score from compare().
§Panics
Panics in debug mode if threshold is not in [0.0, 1.0]. In release mode, out-of-range or NaN thresholds return false.
Trait Implementations§
Source§impl Clone for MultiHashFingerprint
impl Clone for MultiHashFingerprint
Source§fn clone(&self) -> MultiHashFingerprint
fn clone(&self) -> MultiHashFingerprint
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MultiHashFingerprint
impl Debug for MultiHashFingerprint
Source§impl<'de> Deserialize<'de> for MultiHashFingerprint
impl<'de> Deserialize<'de> for MultiHashFingerprint
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for MultiHashFingerprint
impl PartialEq for MultiHashFingerprint
Source§impl Serialize for MultiHashFingerprint
impl Serialize for MultiHashFingerprint
impl Eq for MultiHashFingerprint
impl StructuralPartialEq for MultiHashFingerprint
Auto Trait Implementations§
impl Freeze for MultiHashFingerprint
impl RefUnwindSafe for MultiHashFingerprint
impl Send for MultiHashFingerprint
impl Sync for MultiHashFingerprint
impl Unpin for MultiHashFingerprint
impl UnsafeUnpin for MultiHashFingerprint
impl UnwindSafe for MultiHashFingerprint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more