undouble icon indicating copy to clipboard operation
undouble copied to clipboard

whash-db4 and crop-resistant-hash not working

Open Tyrannas opened this issue 2 years ago • 4 comments

Hello,

I've seen in the docs on readthedocs that in addition to ahash, phash, dhash and whash-haar, there are also whash-db4 and crop-resistant-hash. I'm really interested in the latest but it appears to be not working. I get a "cannot compute hash" error Is it not implemented yet ?

Tyrannas avatar Jun 15 '22 14:06 Tyrannas

And i've also notice that I get this error on whash-haar when using hash_sizes that are not exponentiations of 2. (Although it works for other hashing methods)

Tyrannas avatar Jun 16 '22 10:06 Tyrannas

I added the crop-resistant-hash functionality into the library and to the documentation pages.

Update with: pip install -U undouble

However, this functionality is slightly different compared to the others because the algorithm partitions the image into bright and dark segments, using a watershed-like algorithm, and then does an image hash on each segment. Or in other words, I basically get 2 hashes instead of 1. This is a problem because all of the code is designed to receive a single hash function. I now randomly selected the dark-segments. Not sure how to deal with this.

erdogant avatar Jul 09 '22 20:07 erdogant

Regarding the whash-haar, l show an error message if the hash_size is not power of 2, and then return with None.

erdogant avatar Jul 09 '22 20:07 erdogant

Thank you very much for your answers, regarding the crop resistant problem, a solution could be to use both hashes separatly ? like two differents images in the dataset, but referencing the same file ?

Tyrannas avatar Sep 13 '22 08:09 Tyrannas