Documentation ¶
Overview ¶
Package ish implements a collection of perceptual hash algorithms for digital forensic image processing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode reads from an io.Reader, returning an image and the name of its format. If an error occurs, the returned image is nil and the value of format is undefined.
func Grayscale ¶
Grayscale converts an image to the grayscale colour space, using optimised algorithms for common source colour spaces.
Types ¶
type AverageHash ¶
type AverageHash struct {
// contains filtered or unexported fields
}
AverageHash implements the average hash perceptual hashing algorithm described by Dr. Neal Krawetz.
func NewAverageHash ¶
func NewAverageHash(width, height int) *AverageHash
NewAverageHash returns a new instance of AverageHash.
func (*AverageHash) Distance ¶
func (ah *AverageHash) Distance(ha, hb []byte) int
Distance returns the hamming distance between two difference hashes.
func (*AverageHash) Hash ¶
func (ah *AverageHash) Hash(img image.Image) ([]byte, error)
Hash computes the difference hash of an image by shrinking it and comparing the relative brightness of pixels to the mean brightness of the image.
func (*AverageHash) Length ¶
func (ah *AverageHash) Length() int
Length returns the length of the average hash in bytes.
type DifferenceHash ¶
type DifferenceHash struct {
// contains filtered or unexported fields
}
DifferenceHash implements the difference hash perceptual hashing algorithm described by Dr. Neal Krawetz.
func NewDifferenceHash ¶
func NewDifferenceHash(width, height int) *DifferenceHash
NewDifferenceHash returns a new instance of DifferenceHash.
func (*DifferenceHash) Distance ¶
func (dh *DifferenceHash) Distance(ha, hb []byte) int
Distance returns the hamming distance between two difference hashes.
func (*DifferenceHash) Hash ¶
func (dh *DifferenceHash) Hash(img image.Image) ([]byte, error)
Hash computes the difference hash of an image by shrinking it and comparing the relative brightness of pixels.
func (*DifferenceHash) Length ¶
func (dh *DifferenceHash) Length() int
Length returns the length of the difference hash in bytes.
type PerceptualHash ¶
type PerceptualHash interface { // Hash computes the perceptual hash of an image. Hash(img image.Image) ([]byte, error) // Length returns the length of hashes computed by this percepual hash // in bytes. Length() int // Distance calculates the hamming distance between two perceptual hashes. Distance(ha, hb []byte) int }
PerceptualHash is the interface implemented by perceptual hash algorithms.