JohannesBuchner / imagehash

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

Question: Is it possible to assign a label (value) to each image hash? #188

Closed mehrdadasadiut closed 1 year ago

mehrdadasadiut commented 1 year ago

Hello. I want to have an image database associated with some calculated values. But for future images that I will be encountered, I want to look into database, and if there's similar image (similar hash), then I wont calculate the value again. Indeed, I will return the value of that similar image from database instead.

JohannesBuchner commented 1 year ago

yes, the hash can be converted to a string (see https://github.com/JohannesBuchner/imagehash#storing-hashes). You can use that hash as a key to a dictionary. With a database it works the same way, but you will need to read the documentation how to make a suitable primary key.