Phash distance filter (#3596)

* Add phash_distance filter criterion
* Add distance to phash filter in UI
This commit is contained in:
WithoutPants
2023-04-17 15:36:51 +10:00
committed by GitHub
parent 62a1bc22c9
commit dcc73c4873
13 changed files with 184 additions and 17 deletions

10
pkg/sqlite/phash.go Normal file
View File

@@ -0,0 +1,10 @@
package sqlite
import "github.com/corona10/goimagehash"
func phashDistanceFn(phash1 int64, phash2 int64) (int64, error) {
hash1 := goimagehash.NewImageHash(uint64(phash1), goimagehash.PHash)
hash2 := goimagehash.NewImageHash(uint64(phash2), goimagehash.PHash)
distance, _ := hash1.Distance(hash2)
return int64(distance), nil
}