Skip to main content

Module hashers

Module hashers 

Source
Expand description

Built-in perceptual hash implementations.

This module provides various hash algorithms for duplicate frame detection:

  • DHasher: Difference hash - fast, good for near-duplicates
  • PHasher: Perceptual hash (DCT) - robust to transformations
  • BlockHasher: Block average hash - balanced approach

All hashers implement the FrameHasher trait and can be used interchangeably.

§Choosing a Hasher

AlgorithmSpeedRobustnessBest For
dHashFastModerateFrame-to-frame comparison
pHashSlowHighContent matching across transforms
BlockHashMediumMediumGeneral purpose

For GIF frame analysis, dHash is recommended as the default due to its speed and effectiveness for detecting consecutive duplicate frames.

Structs§

BlockHasher
Block hash for perceptual image comparison.
DHasher
Difference hash (dHash) for fast duplicate detection.
ImageHash
Re-export the ImageHash type from img_hash for convenience. A struct representing an image processed by a perceptual hash. For efficiency, does not retain a copy of the image data after hashing.
PHasher
Perceptual hash (pHash) using Discrete Cosine Transform.