"""
    compare 2 images via simple hash + hamming distance

    Source Material: https://en.wikipedia.org/wiki/Hamming_weight

    author: James Jenkins
    author: Bradon Arrendondo
    author: Austin Jones
"""

from PIL import Image
import simplehash
import hamming

DEFAULT_THUMBNAIL_SIZE = (16,16)

#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

if __name__=="__main__":
    """
        compares 2 images with simple hash
    """

    i1 = Image.open("Albums/q/wcd_quick-draw_alex_flac_lossless_31006609.jpg")
    i2 = Image.open("Albums/q/wcd_quantum-fucking_fatal-flying-guillot_mp3_192_81102.jpg")

    s_h1=simplehash.simple_hash(i1,DEFAULT_THUMBNAIL_SIZE)
    s_h2=simplehash.simple_hash(i2,DEFAULT_THUMBNAIL_SIZE)

    print "Simple_hash similarity: %i" % hamming.hamming_dist(s_h1,s_h2)

#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

