Created
March 6, 2017 04:26
-
-
Save dmpetrov/46a47557d52f9c44001de1d629619b8d to your computer and use it in GitHub Desktop.
Perceptual image hashing
This file contains 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 | |
hash1 = imagehash.phash(Image.open(‘test1.jpg’)) | |
print(hash1) | |
# > 354adab5054af0b7 | |
hash2 = imagehash.phash(Image.open(‘test2.jpg’)) | |
print(hash2) | |
# > 5b7724c8bb364551 | |
hash1 == hash2 | |
# > False | |
hash1 – hash2 | |
# > 44 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment