ameingast / cocoaimagehashing

Perceptual Image Hashing for macOS, iOS, tvOS and watchOS
Other
262 stars 66 forks source link

DCT algorithm fixes #24

Closed adematalay closed 4 years ago

adematalay commented 4 years ago

There are 2 fixes

  1. One row is missing while converting to grayscale
  2. In DCT formula below, the coefficient should be 1 / sort(2 * n) which is 8 for 32x32 DCT

dct

ameingast commented 4 years ago

Thanks for contributing!

The changes look fine, except for failing tests (OSPHashTests - testImageDiversityOnPHash). The only platform affected seems to be macOS. Any idea what the cause could be?

adematalay commented 4 years ago

iOS and Mac implementations are using different colour spaces, thus they produce different hash values some of the cases. I set both of them to same value and all tests are passing now.

ameingast commented 4 years ago

Thanks, looks like this patch fixes iOS and macOS inconsistencies in hash calculation. I will do some test runs when I have more free time on my hand and then merge it in.