Skip to content

Instantly share code, notes, and snippets.

@dmpetrov
Created March 6, 2017 04:43
Show Gist options
  • Save dmpetrov/904778d8d17a3d8550a39f99c5a4a508 to your computer and use it in GitHub Desktop.
Save dmpetrov/904778d8d17a3d8550a39f99c5a4a508 to your computer and use it in GitHub Desktop.
Wavelet imagehash for Barbara image
# Code for the blogpost https://fullstackml.com/2016/07/02/wavelet-image-hash-in-python/
barb = PIL.Image.open(‘barbara.jpg’)
w_b = imagehash.whash(barb)
h_b = imagehash.phash(barb)
a_b = imagehash.average_hash(barb)
(a — a_b)/len(a.hash)**2
# > 0.5
(h — h_b)/len(w.hash)**2
# > 0.53125
(w — w_b)/len(w.hash)**2
# > 0.4375
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment