Skip to content

Commit

Permalink
Update galaktaglare.go
Browse files Browse the repository at this point in the history
  • Loading branch information
simplyYan authored Jan 25, 2024
1 parent 646c376 commit 75f05a6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion galaktaglare.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@ func (gg *GalaktaGlare) ImageScan(imagePath string) (float64, error) {
}

func hashSimilarity(hash1, hash2 uint64) float64 {
hashStr1 := fmt.Sprintf("%064b", hash1)
hashStr2 := fmt.Sprintf("%064b", hash2)

distance := goimagehash.HammingDistance(hash1, hash2)
distance := goimagehash.HammingDistanceByString(hashStr1, hashStr2)

Check failure on line 114 in galaktaglare.go

View workflow job for this annotation

GitHub Actions / build

undefined: goimagehash.HammingDistanceByString
normalizedDistance := float64(distance) / 64.0
similarity := 1.0 - normalizedDistance
return similarity
Expand Down

0 comments on commit 75f05a6

Please sign in to comment.