Closed artyom-razinov closed 5 years ago
It seems that calculation is platform-dependent: tests fail on a different platform (it reproduces locally as well).
This test fails on 32-bit iPhone 4S (iOS 9.3): testResizedRGBABitmapDataScanline aHash and dHash calculation is different on different devices. E.g. aHash values for same image: on Mac OS: -8608481637110868033 64 bit iPhone Sim: -8608472703578630209 32 bit iPhone Sim: -8608191228601917505
Is my fix in pHash worth merging?
Absolutely, but I don't want to break backwards compatibility.
If you provide a new hash-type (.pHashNoFrequencies ? - I can't think of a better name) we can talk about merging this in.
Closing due to inactivity.
15 of lowest 64 frequencies were ignored instead of suggested 1. This caused images with low details produce 0 hash (e.g.: screenshots of UI).
Note that this breaks compatibility with previously generated values of pHash. I've added tests that check future possible regression of values.
My reference to the algorithm was: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html#c1410