imagehash

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 29, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package imagehash processes a Perception hash and Average hash from an image.

Index

Constants

View Source
const (
	NilPhash    Phash = 0
	NilAhash    Ahash = 0
	LengthPHash       = 8
)

Constants

Variables

View Source
var (
	ErrImageObject = errors.New("image object can not be nil")
)

Variables

Functions

This section is empty.

Types

type Ahash

type Ahash uint64

Ahash is a 64bit Average Hash

func NewAHash

func NewAHash(img image.Image) (ahash Ahash, err error)

NewAHash is an Average Hash fuction that returns a hash computation of average hash. Implementation follows http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html

func (*Ahash) DecodeMsg

func (z *Ahash) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (Ahash) EncodeMsg

func (z Ahash) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (Ahash) MarshalMsg

func (z Ahash) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Ahash) Msgsize

func (z Ahash) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Ahash) UnmarshalMsg

func (z *Ahash) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Phash

type Phash uint64

Phash is a 64bit Perception Hash

func NewPHash

func NewPHash(img image.Image) (phash Phash, err error)

NewPHash is a Perception Hash function returns a hash computation of phash. Implementation follows http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html

func NewPHashFast

func NewPHashFast(img image.Image) (phash Phash, err error)

NewPHashFast is a Perception Hash function returns a hash computation of phash. Implementation follows http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html Has been manually optimized for perforance and reduced memory footprint.

func (*Phash) Decode

func (ph *Phash) Decode(buf []byte)

func (*Phash) DecodeMsg

func (z *Phash) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (Phash) Distance

func (ph Phash) Distance(hash Phash) uint8

Distance between Phash values

func (Phash) Encode

func (ph Phash) Encode(buf []byte)

func (Phash) EncodeMsg

func (z Phash) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (Phash) MarshalMsg

func (z Phash) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Phash) Msgsize

func (z Phash) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (Phash) String

func (ph Phash) String() string

func (*Phash) UnmarshalMsg

func (z *Phash) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Directories

Path Synopsis
Package transforms provides the transformations for imagehash
Package transforms provides the transformations for imagehash

Jump to

Keyboard shortcuts

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