Overview
Imghash uses three concrete hash types to represent different kinds of perceptual hashes, all implementing the commonHash interface.
Hash Interface
The base interface implemented by all hash types:Methods
Returns a string representation of the hash.
A formatted string representation of the hash data.
Returns the length of the hash.
- For
Binary: number of bytes - For
UInt8: number of uint8 elements - For
Float64: number of float64 elements
Binary
Represents a hash where the smallest element is a bit. Used by most traditional perceptual hash algorithms.Constructor
Methods
Usage Example
UInt8
Represents a hash where the smallest element is a uint8 value. Used by histogram-based algorithms.Methods
Usage Example
Float64
Represents a hash where the smallest element is a float64. Used by feature-based algorithms.Methods
Usage Example
Distance Type
Represents a similarity measure between two hashes:Methods
Usage Example
Errors
Type Assertions
You can use type assertions to work with specific hash types:See Also
- Hasher Interface - For computing hashes
- Similarity Functions - For comparing hashes