I think you should use hashes for comparison.
Refer this link:
https://stackoverflow.com/questions/1684799/generate-hash-from-uiimage/1685319#1685319
It will help you.