Answer the question
In order to leave comments, you need to log in
POSTGRES: how to search for similar images using phash?
Good evening.
Somehow I was interested in the question of searching for similar images: Compare images and search for similar ones?
The bottom line is this: the site stores images, the data of which is in the database. When a new image is uploaded, its phash is calculated and records with a small deviation are searched in the database. There are none - it means the image is new and has not been loaded before.
I found how to count phash. Java implementation: pastebin.com/Pj9d8jt5
I find the
hash. But how to store hashes and how to search by Hamming distance?
Actually, that's what is not clear:
1. Store as a string or is there a more suitable format, provided that there are only ones and zeros?
2. How to search? Roughly speaking:
select * from tbl_iamge where hammingDistance(<мой хеш>, hash) < <минимальное допустимое различие>
Is there a built-in operator for such calculations or do I need to write my own function? Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question