Expand description
Built-in perceptual hash implementations.
This module provides various hash algorithms for duplicate frame detection:
DHasher: Difference hash - fast, good for near-duplicatesPHasher: Perceptual hash (DCT) - robust to transformationsBlockHasher: Block average hash - balanced approach
All hashers implement the FrameHasher trait
and can be used interchangeably.
§Choosing a Hasher
| Algorithm | Speed | Robustness | Best For |
|---|---|---|---|
| dHash | Fast | Moderate | Frame-to-frame comparison |
| pHash | Slow | High | Content matching across transforms |
| BlockHash | Medium | Medium | General purpose |
For GIF frame analysis, dHash is recommended as the default due to its speed and effectiveness for detecting consecutive duplicate frames.
Structs§
- Block
Hasher - Block hash for perceptual image comparison.
- DHasher
- Difference hash (dHash) for fast duplicate detection.
- Image
Hash - 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.