84eb1859d0
Create a new APIs for serializing purpose which can use standard io.Reader/io.Writer APIs. ToString() API will be remain for debugging purpose and ExtImageHashFromString, ImageHashFromString will be removed after next version. - New APIs are added: LoadExtImageHash, LoadImageHash, xxxHash.Dump - These APIs are deprecated: ExtImageHashFromString, ImageHashFromString |
||
---|---|---|
_examples | ||
etcs | ||
transforms | ||
vendor/github.com/nfnt/resize | ||
.gitignore | ||
.travis.yml | ||
AUTHORS.md | ||
CODEOWNERS | ||
doc.go | ||
Gopkg.lock | ||
Gopkg.toml | ||
hashcompute_test.go | ||
hashcompute.go | ||
imagehash18.go | ||
imagehash19.go | ||
imagehash_test.go | ||
imagehash.go | ||
LICENSE | ||
README.md |
goimagehash
Inspired by imagehash
A image hashing library written in Go. ImageHash supports:
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.4.0(TBA)
- IMPORTANT goimagehash v0.0.4 does not have compatible with the before version when it comes to the serialization.
v0.3.0
- Support DifferenceHashExtend.
- Support AverageHashExtend.
- Support PerceptionHashExtend by @TokyoWolFrog.
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