mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Phash distance filter (#3596)
* Add phash_distance filter criterion * Add distance to phash filter in UI
This commit is contained in:
10
pkg/sqlite/phash.go
Normal file
10
pkg/sqlite/phash.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user