Created
March 6, 2017 04:39
-
-
Save dmpetrov/f96ea73a95be1ff93f2f5af7850ba614 to your computer and use it in GitHub Desktop.
Wavelet imagehash for Lenna image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Code for the blogpost https://fullstackml.com/2016/07/02/wavelet-image-hash-in-python/ | |
import PIL | |
from PIL import Image | |
import imagehash | |
w = imagehash.whash(PIL.Image.open(‘lenna.png’)) | |
w1 = imagehash.whash(PIL.Image.open(‘lenna1.jpg’)) | |
w2 = imagehash.whash(PIL.Image.open(‘lenna2.jpg’)) | |
(w — w1)/len(w.hash)**2 | |
# > 0.03125 | |
(w — w2)/len(w.hash)**2 | |
# > 0.28125 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FYI, the code seems to have been smartypants'd OSLT (Unicode quotes, dashes and whitespace instead of ASCII characters).
Fixed:
Thanks for the article.