Add rotational invariant hash
KilianB opened this issue · 3 comments
WIP.
Probably derived from https://www.idosi.org/mejsr/mejsr24(4)16/75.pdf
Multiple version have been implemented and will be shipped with the next major version. The paper does not exactly outline how the hash is created and it's not fully compatible with what JImageHash is doing. Therefore an approach was adapted.
-
Precomputation -> resize and extract Y luma component
-
Ring parition. Rotate pixels around the center and fit it into a bucket
-
Sorting the lum values of each bucket increasingly and compute a 1d dct transformation. Compute hash by comparing the values to the mean of each bucket. (Multiple bits per bucket)
3.1 (alternative) A gradient version also exists which simply compares the mean of each ring partition. With this approach we get a perfect 0 distance hash for %90 rotations but need to compute a lot of data. Slow and not worth the effort. Semantically this approach isn't clean either as an increase in ring partition index (the further out you go) means more actual pixels are represented in a single bit value.
Partially resolved with #13 . Maybe look at different approaches in the future e.g.
http://www.jaist.ac.jp/~kurkoski/papers/conf/Parrao-Hernandex-mwcas11.pdf