Skip to content

About

Go Perceptual image hashing package

Resources

Stars

0 stars

Watchers

1 watching

Forks

 
 

Repository files navigation

Build Status GoDoc Go Report Card Coverage Status

This is a fork of corona10/goimagehash. Changes:

  • Somewhat more straightforward API.
  • A tiny bit faster.

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 := goimagehash.Distance(hash1, hash2)
        fmt.Printf("Distance between images: %v\n", distance)

        hash1 = goimagehash.DifferenceHash(img1)
        hash2 = goimagehash.DifferenceHash(img2)
        distance = goimagehash.Distance(hash1, 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

About

Go Perceptual image hashing package

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

⌂ 换网址