# -*- coding: utf-8 -*-
from PIL import Image
from PIL import ImageFilter
from PIL import ImageOps
# This module can classfy the image by Average Hash Method
# The Hash Method is too strict,so this moudel suitable for finding image by Thumbnail
def getCode(img, size):
pixel = []
for x in range(0, size[0]):
for y in range(0, size[1]):
pixel_value = img.getpixel((x, y))
print pixel_value
pixel.append(pixel_value)
avg = sum(pixel) / len(pixel)
cp = []
for px in pixel:
if px > avg:
cp.append(1)
else:
cp.append(0)
return cp
def compCode(code1, code2):
num = 0
from PIL import Image
from PIL import ImageFilter
from PIL import ImageOps
# This module can classfy the image by Average Hash Method
# The Hash Method is too strict,so this moudel suitable for finding image by Thumbnail
def getCode(img, size):
pixel = []
for x in range(0, size[0]):
for y in range(0, size[1]):
pixel_value = img.getpixel((x, y))
print pixel_value
pixel.append(pixel_value)
avg = sum(pixel) / len(pixel)
cp = []
for px in pixel:
if px > avg:
cp.append(1)
else:
cp.append(0)
return cp
def compCode(code1, code2):
num = 0