fingerprint

package
v3.2.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2016 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package fingerprint provides fingerprinting of images.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BMVDelta

func BMVDelta(h, g BMVHash) float64

BMVDelta returns the difference between the two block mean value hashes h and g. The difference is in the range [0,1] with 0 for identical hashes and 1 for maximal different hashes (i.e. a Hamming distance of 64). The lowest significant difference in BMVHashes is 2 bits corrsponding to a delta of 2/64 = 0.03125.

func ColorHistDelta

func ColorHistDelta(h, g ColorHist) float64

ColorHistDelta returns the difference between the two color histograms h and g. The difference is in the range [0,1] with 0 for identical color histograms and 1 for maximal different histograms.

Types

type BMVHash

type BMVHash uint64

BMVHash is the 64 bit block mean value hash of an image. The following references contain more information: Di Wu, Xuebing Zhou, and Xiamu Niu. 2009. A novel image hash algorithm resistant to print-scan. Signal Process. 89, 12 (December 2009), 2415-2424. As described in Christoph Zauner: "Implementation and Benchmarking of Perceptual Image Hash Functions" DIPLOMARBEIT, FH Hagenberg, Juli 2010.

func BMVHashFromString

func BMVHashFromString(s string) (BMVHash, error)

BMVHashFromString parses the hexadecimal number in s and panics if s cannot be parsed to a uint64.

func NewBMVHash

func NewBMVHash(img image.Image) BMVHash

NewBMVHash computes the block mean value hash of img. The following degenerate case return special values:

  • If one or both dimensions of the image are < 8 then BMV hash of 0 (i.e. 64 0s) is returned.
  • If one dimension is smaller than 16 a fingerprint of 64 1s is returned.

func (BMVHash) HammingDistance

func (h BMVHash) HammingDistance(v BMVHash) int

HammingDistance returns the Hammig distance between the bit strings of h and g.

func (BMVHash) Image

func (h BMVHash) Image(width, height int) *image.Gray

Image "reconstructs" the original image through gray panels. The generated image has dimensions width x height. Both dimensions must be at least 8.

func (BMVHash) String

func (h BMVHash) String() string

String returns h in hexadecimal form.

type ColorHist

type ColorHist [24]byte

ColorHist is a normalized color histogram based on the colors from the Greta Mecbeth Color Picker.

func ColorHistFromString

func ColorHistFromString(s string) (ColorHist, error)

ColorHistFromString converts 24 hex digits to a ColorHist.

func NewColorHist

func NewColorHist(img image.Image) ColorHist

NewColorHist computest the color histogram of img.

func (ColorHist) Image

func (h ColorHist) Image(width, height int) *image.RGBA

Image reconstructs the original image from the color histogram.

func (ColorHist) String

func (h ColorHist) String() string

String produces a string representation by renormalizing the histogram to 16 so that it can be encoded in 24 hex digits.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL