Go to file
Alex c41a59a872 add PerceptionHashExtend function (#18)
goimagehash: Implement PerceptionHashExtend
2019-02-08 18:02:25 +09:00
_examples [goimagehash] First implement. 2017-07-31 22:47:14 +09:00
etcs goimagehash: Fix quickselect algorithm to pick median value. 2018-05-08 13:33:43 +09:00
transforms transforms: Fix the logic which getting a size of image 2018-08-19 16:35:17 +09:00
vendor/github.com/nfnt/resize [goimagehash] First implement. 2017-07-31 22:47:14 +09:00
.gitignore Initial commit 2017-07-29 02:15:59 +09:00
.travis.yml .travis.yml: Update Go 1.11 2018-10-01 17:34:07 +09:00
AUTHORS.md add PerceptionHashExtend function (#18) 2019-02-08 18:02:25 +09:00
CODEOWNERS [goimagehash] First implement. 2017-07-31 22:47:14 +09:00
doc.go [goimagehash] First implement. 2017-07-31 22:47:14 +09:00
Gopkg.lock [goimagehash] First implement. 2017-07-31 22:47:14 +09:00
Gopkg.toml [goimagehash] First implement. 2017-07-31 22:47:14 +09:00
hashcompute_test.go add PerceptionHashExtend function (#18) 2019-02-08 18:02:25 +09:00
hashcompute.go add PerceptionHashExtend function (#18) 2019-02-08 18:02:25 +09:00
imagehash18.go Use bits.OnesCount64 when available 2018-05-02 23:52:38 +09:00
imagehash19.go Use bits.OnesCount64 when available 2018-05-02 23:52:38 +09:00
imagehash_test.go add PerceptionHashExtend function (#18) 2019-02-08 18:02:25 +09:00
imagehash.go add PerceptionHashExtend function (#18) 2019-02-08 18:02:25 +09:00
LICENSE Initial commit 2017-07-29 02:15:59 +09:00
README.md goimagehash: Update README.md 2018-05-09 09:37:49 +09:00

Build Status GoDoc Go Report Card Coverage Status

goimagehash

Inspired by imagehash

A image hashing library written in Go. ImageHash supports:

Only support 64bits hash.

Installation

go get github.com/corona10/goimagehash

Special thanks to

Usage

func main() {
        file1, _ := os.Open("sample1.jpg")
        file2, _ := os.Open("sample2.jpg")
        defer file1.Close()
        defer file2.Close()

        img1, _ := jpeg.Decode(file1)
        img2, _ := jpeg.Decode(file2)
        hash1, _ := goimagehash.AverageHash(img1)
        hash2, _ := goimagehash.AverageHash(img2)
        distance, _ := hash1.Distance(hash2)
        fmt.Printf("Distance between images: %v\n", distance)

        hash1, _ = goimagehash.DifferenceHash(img1)
        hash2, _ = goimagehash.DifferenceHash(img2)
        distance, _ = hash1.Distance(hash2)
        fmt.Printf("Distance between images: %v\n", distance)
}

Release Note

v0.2.0

  • Perception Hash is updated.
  • Fix a critical bug of finding median value.

v0.1.0

  • Support Average hashing
  • Support Difference hashing
  • Support Perception hashing
  • Use bits.OnesCount64 for computing Hamming distance by @dominikh
  • Support hex serialization methods to ImageHash by @brunoro