Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Average ¶
type Average struct {
// contains filtered or unexported fields
}
Average is a perceptual hash that uses the method described in Looks Like It by Dr. Neal Krawetz.
See https://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html for more information.
func NewAverage ¶
func NewAverage() Average
NewAverage creates a new Average struct using default values.
func NewAverageWithParams ¶
func NewAverageWithParams(resizeWidth, resizeHeight uint, resizeType imgproc.ResizeType) Average
NewAverageWithParams creates a new Average struct based on supplied parameters.
func (*Average) Calculate ¶
Calculate returns a perceptual image hash.
Example ¶
// Read image from file
img, _ := imgproc.Read("assets/cat.jpg")
// Create new Average Hash using default parameters
avg := NewAverage()
// Calculate hash
hash := avg.Calculate(img)
fmt.Println(hash)
Output: [255 255 15 7 1 0 0 0]
type BlockMean ¶
type BlockMean struct {
// contains filtered or unexported fields
}
BlockMean is a perceptual hash that uses the method described in Block Mean Value Based Image Perceptual Hashing; Yang et. al.
See https://ieeexplore.ieee.org/document/4041692 for more information.
func NewBlockMean ¶
func NewBlockMean() BlockMean
NewBlockMean creates a new BlockMean struct using default values.
func NewBlockMeanWithParams ¶
func NewBlockMeanWithParams(resizeWidth, resizeHeight uint, resizeType imgproc.ResizeType, blockWidth, blockHeight uint, blockMeanMethod BlockMeanMethod) BlockMean
NewBlockMeanWithParams creates a new BlockMean struct using the supplied parameters.
func (*BlockMean) Calculate ¶
Calculate returns a perceptual image hash.
Example ¶
// Read image from file
img, _ := imgproc.Read("assets/cat.jpg")
// Create new Block Mean Hash using default parameters
block := NewBlockMean()
// Calculate hash
hash := block.Calculate(img)
fmt.Println(hash)
Output: [255 255 255 255 255 255 255 255 255 225 127 0 63 0 15 0 7 2 3 0 1 0 1 0 0 0 0 0 0 0 116 4]
type BlockMeanMethod ¶
type BlockMeanMethod int
BlockMeanMethod represents the method used when computing the mean of blocks.
const ( // Direct method constructs blocks with no overlap or rotation. Direct BlockMeanMethod = iota // Overlap method constructs blocks by overlapping them, the degree of overlap is set to be half of a block. Overlap // Rotation method uses the same approach as Direct but also rotates blocks. Rotation // RotationOverlap uses the same approach as Overlap but also rotates blocks. RotationOverlap )
TODO: Add support for rotation based block mean hashes.
type ColorMoment ¶
type ColorMoment struct {
// contains filtered or unexported fields
}
ColorMoment is a perceptual hash that uses the method described in Perceptual Hashing for Color Images Using Invariant Moments; Tang et. al.
See https://www.researchgate.net/publication/286870507_Perceptual_hashing_for_color_images_using_invariant_moments for more information.
func NewColorMoment ¶
func NewColorMoment() ColorMoment
NewColorMoment creates a new ColorMoment struct using default values.
func NewColorMomentWithParams ¶
func NewColorMomentWithParams(resizeWidth, resizeHeight uint, resizeType imgproc.ResizeType, kernelSize int, sigma float64) ColorMoment
NewColorMomentWithParams creates a new ColorMoment struct based on supplied parameters.
func (*ColorMoment) Calculate ¶
func (ch *ColorMoment) Calculate(img image.Image) hashtype.Float64
Calculate returns a perceptual image hash.
Example ¶
// Read image from file
img, _ := imgproc.Read("assets/cat.jpg")
// Create new Color Moment Hash using default parameters
color := NewColorMoment()
// Calculate hash
hash := color.Calculate(img)
fmt.Println(hash)
type Difference ¶
type Difference struct {
// contains filtered or unexported fields
}
Difference is a perceptual hash that uses the method described in Kinf of Like That by Dr. Neal Krawetz.
See https://www.hackerfactor.com/blog/index.php?/archives/529-Kind-of-Like-That.html for more information.
func NewDifference ¶
func NewDifference() Difference
NewDifference creates a new Difference struct using default values.
func NewDifferenceWithParams ¶
func NewDifferenceWithParams(resizeWidth, resizeHeight uint, resizeType imgproc.ResizeType) Difference
NewDifferenceWithParams creates a new Difference struct based on supplied parameters.
func (*Difference) Calculate ¶
func (dh *Difference) Calculate(img image.Image) hashtype.Binary
Calculate returns a perceptual image hash.
Example ¶
// Read image from file
img, _ := imgproc.Read("assets/cat.jpg")
// Create new Difference Hash using default parameters
diff := NewDifference()
// Calculate hash
hash := diff.Calculate(img)
fmt.Println(hash)
Output: [6 2 194 64 124 60 16 16]
type MarrHildreth ¶
type MarrHildreth struct {
// contains filtered or unexported fields
}
MarrHildreth is a perceptual hash that uses the method described in Implementation and Benchmarking of Perceptual Image Hash Functions; Zauner et. al.
See https://www.researchgate.net/publication/252340846_Rihamark_Perceptual_image_hash_benchmarking for more information.
Example (Calculate) ¶
// Read image from file
img, _ := imgproc.Read("assets/cat.jpg")
// Create new Marr-Hildreth Hash using default parameters
marr := NewMarrHildreth()
// Calculate hash
hash := marr.Calculate(img)
fmt.Println(hash)
Output: [92 190 42 111 87 107 101 164 184 24 75 41 185 54 178 162 26 236 155 150 108 98 233 112 56 235 124 177 139 159 148 66 89 38 229 47 195 44 158 180 85 115 79 165 92 131 225 252 54 148 218 61 99 92 82 141 141 96 112 186 185 208 174 112 252 150 153 164 173 206 43 130]
func NewMarrHildreth ¶
func NewMarrHildreth() MarrHildreth
NewMarrHildreth creates a new MarrHildreth struct using default values.
func NewMarrHildrethWithParams ¶
func NewMarrHildrethWithParams(scale, alpha float64, resizeWidth, resizeHeight uint, resizeType imgproc.ResizeType, kernelSize int, sigma float64) MarrHildreth
NewMarrHildrethWithParams creates a new MarrHildreth struct using the supplied parameters.
type Median ¶
type Median struct {
// contains filtered or unexported fields
}
Median is a perceptual hash that uses a similar approach as Average hash. But instead of using mean it uses median to compute the average value. See https://github.com/Quickshot/DupImageLib/blob/3e914588958c4c1871d750de86b30446b9c07a3e/DupImageLib/ImageHashes.cs#L99 for more information.
func NewMedian ¶
func NewMedian() Median
NewMedian creates a new Median struct using default values.
func NewMedianWithParams ¶
func NewMedianWithParams(resizeWidth, resizeHeight uint, resizeType imgproc.ResizeType) Median
NewMedianWithParams creates a new Median struct using the supplied parameters.
func (*Median) Calculate ¶
Calculate returns a perceptual image hash.
Example ¶
// Read image from file
img, _ := imgproc.Read("assets/cat.jpg")
// Create new Median Hash using default parameters
med := NewMedian()
// Calculate hash
hash := med.Calculate(img)
fmt.Println(hash)
Output: [255 255 31 7 1 1 1 39]
type PHash ¶
type PHash struct {
// contains filtered or unexported fields
}
PHash is a perceptual hash that uses the method described in Implementation and Benchmarking of Perceptual Image Hash Functions; Zauner et. al.
See https://www.researchgate.net/publication/252340846_Rihamark_Perceptual_image_hash_benchmarking for more information.
func NewPHashWithParams ¶
func NewPHashWithParams(resizeWidth, resizeHeight uint, resizeType imgproc.ResizeType) PHash
NewPHashWithParams creates a new PHash struct using the supplied parameters.
func (*PHash) Calculate ¶
Calculate returns a percaptual image hash.
Example ¶
// Read image from file
img, _ := imgproc.Read("assets/cat.jpg")
// Create new PHash using default parameters
ph := NewPHash()
// Calculate hash
hash := ph.Calculate(img)
fmt.Println(hash)
Output: [170 195 65 29 10 2 38 84]
type RadialVariance ¶
type RadialVariance struct {
// contains filtered or unexported fields
}
RadialVariance is a perceptual hash that uses the method described in Robust image hashing based on radial variance of pixels; De Roover et. al.
See https://www.researchgate.net/publication/4186555_Robust_image_hashing_based_on_radial_variance_of_pixels for more information.
func NewRadialVariance ¶
func NewRadialVariance() RadialVariance
NewRadialVariance creates a new RadialVariance struct using default values.
func NewRadialVarianceWithParams ¶
func NewRadialVarianceWithParams(sigma float64, numOfAngleLines int) RadialVariance
NewRadialVarianceWithParams creates a new RadialVariance struct based on supplied parameters.
func (*RadialVariance) Calculate ¶
func (rv *RadialVariance) Calculate(img image.Image) hashtype.UInt8
Calculate returns a perceptual image hash.
Example ¶
// Read image from file
img, _ := imgproc.Read("assets/cat.jpg")
// Create new Radial Variance Hash using default parameters
rad := NewRadialVariance()
// Calculate hash
hash := rad.Calculate(img)
fmt.Println(hash)
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package hashtype implements data types used to represent hashes.
|
Package hashtype implements data types used to represent hashes. |
|
Package similarity implements data types and methods used to calculate similarities between hashes.
|
Package similarity implements data types and methods used to calculate similarities between hashes. |