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)
Output: [0.007840559221738475 2.2034498359157744e-07 8.684939637320095e-09 1.3195340752596305e-08 1.361994698531565e-16 -3.128016142811829e-12 3.7465225373114406e-17 0.0016131824928845837 4.150246244542602e-08 7.635890095045098e-11 2.1849001025983358e-11 4.1135742177399834e-22 -4.4427924315240715e-15 7.91976998613191e-22 0.001045548809225742 2.772613007864512e-09 1.337261180170139e-11 1.6167463698622338e-11 7.006891104009164e-24 2.9211456863128017e-16 2.376195809939422e-22 0.0011816509074528167 2.9408079432297224e-09 3.061401364698586e-11 3.893655593746319e-11 2.84267196907831e-22 9.85794678916472e-16 1.3139013030470254e-21 0.0011755591858654255 1.4306034607639147e-10 5.391803318981961e-13 3.8112496595287077e-13 1.6424203326396093e-25 -2.0998441435316273e-18 5.360968121680658e-26 0.0015080347084822899 1.7821772814069935e-10 1.1621533470920317e-13 5.113034793145402e-13 -1.1298961074948206e-25 -2.3943853547045442e-18 5.261115642777516e-26]
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: [51 1 228 237 182 92 200 237 102 109 182 60 12 178 88 222 73 182 108 124 27 36 183 79 226 73 182 76 134 68 237 229 163 242 73 182 36 159 11 115 118 76 152 151 180 100 248 11 97 121 38 145 169 45 45 146 91 31 13 33 60 95 38 47 131 201 32 253 160 108 188 27]
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 3 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 211 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)
Output: [166 246 10 0 124 194 254 203 219 156 116 176 226 154 138 184 195 174 155 143 213 154 170 209 125 152 173 167 181 170 165 183 157 179 174 162 161 171 157 194]
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. |