JohannesBuchner / imagehash

A Python Perceptual Image Hashing Module
BSD 2-Clause "Simplified" License
3.19k stars 329 forks source link

Comparing a captured image Hash with a database of image hashes #156

Closed gtzippy closed 2 years ago

gtzippy commented 2 years ago

I have a little program that is capturing an image through a webcam and hashing that image. When using a small set of data, I can just have a bunch of hashes on hand and do the capturedHash-storedHash and look for a difference of less than 10 or so. That works great. However, when I have a ton of hashes and I want to keep them in a database, I need to be able to take that captured has and look for something similar to it without going through thousands of entries in a db.

Ideally, I would like to do a comparison similar to capturedHash-storedHash, but in reverse. I'm trying to figure out a way to take my captured hash then add and subtract something to make a similarity threshold above and below the value of that captured hash. Then I could ask my database if there are any values between those 2 values. I have not been able to figure out how to do this with the library and I am wondering if there is a way to do it or if I need to try and make something new.

I know this might not be an "issue" but I can't think of where else to go for help. Thanks in advance for any help!

JohannesBuchner commented 2 years ago

Have a look at https://github.com/JohannesBuchner/imagehash/issues/127

JohannesBuchner commented 2 years ago

specifically the links in the last comment