imagehash

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

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

Variables

Functions

func EncodeBlurHashFast

func EncodeBlurHashFast(img image.Image) (string, error)

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 PHash256

type PHash256 [4]uint64

PHash256 is a 256bit Perception Hash

func NewPHash256

func NewPHash256(img image.Image) (phash PHash256, err error)

NewPHash256 is a Perception Hash function returns a 256bit hash computation Implementation follows: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html Optimized for performance and reduced memory footprint.

func NewPHash256Alt

func NewPHash256Alt(img image.Image) (phash PHash256, err error)

NewPHash256Alt is a Perception Hash function returns a 256bit hash computation Implementation follows: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html Optimized for performance and reduced memory footprint.

func (*PHash256) Decode

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

func (*PHash256) DecodeMsg

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

DecodeMsg implements msgp.Decodable

func (PHash256) Distance

func (ph PHash256) Distance(hash PHash256) uint

Distance between Phash values

func (PHash256) Encode

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

func (*PHash256) EncodeMsg

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

EncodeMsg implements msgp.Encodable

func (*PHash256) MarshalMsg

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

MarshalMsg implements msgp.Marshaler

func (*PHash256) Msgsize

func (z *PHash256) Msgsize() (s int)

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

func (PHash256) String

func (ph PHash256) String() string

func (*PHash256) UnmarshalMsg

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

UnmarshalMsg implements msgp.Unmarshaler

type PHash64

type PHash64 uint64

PHash64 is a 64bit Perception Hash

func NewPHash64

func NewPHash64(img image.Image) (phash PHash64, err error)

NewPHash64 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 Optimized for performance and reduced memory footprint.

func NewPHash64Alt

func NewPHash64Alt(img image.Image) (phash PHash64, err error)

NewPHash64Alt 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 Optimized for performance and reduced memory footprint.

func (*PHash64) Decode

func (ph *PHash64) Decode(src []byte)

func (*PHash64) DecodeMsg

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

DecodeMsg implements msgp.Decodable

func (PHash64) Distance

func (ph PHash64) Distance(hash PHash64) uint8

Distance between Phash values

func (PHash64) Encode

func (ph PHash64) Encode(dst []byte)

func (PHash64) EncodeMsg

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

EncodeMsg implements msgp.Encodable

func (PHash64) MarshalMsg

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

MarshalMsg implements msgp.Marshaler

func (PHash64) Msgsize

func (z PHash64) Msgsize() (s int)

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

func (PHash64) String

func (ph PHash64) String() string

func (*PHash64) UnmarshalMsg

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

UnmarshalMsg implements msgp.Unmarshaler

type Phash

type Phash = PHash64

Phash is a type alias for PHash64

Directories

Path Synopsis
Package transforms provides the transformations for imagehash
Package transforms provides the transformations for imagehash
Package transforms32 contains DCT transformations
Package transforms32 contains DCT transformations

Jump to

Keyboard shortcuts

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