Skip to content

yasinnaal/python-data-mining

Repository files navigation

Data Mining with Python

GitHub PyPI - Python Version

Anaconda: https://www.anaconda.com/products/individual

VS Code: https://code.visualstudio.com

Xcode: https://developer.apple.com/xcode

Jupyter: https://jupyter.org

any suggestions or feedback write to me here


Check two images similarity

anytext

from PIL import Image
import imagehash

hash1 = imagehash.average_hash(Image.open('bike.jpg')) 
hash2 = imagehash.average_hash(Image.open('bike.jpg')) 
cutoff = 5

if hash1 - hash2 < cutoff:
  print('image1 average hash value:', hash1)
  print('image2 average hash value:', hash2)  
  print('MATCH -images are similar.')
  
else:
  print('image1 average hash value:', hash1)
  print('image2 average hash value:', hash2)    
  print('NO MATCH - images are not similar !')

image1: fffff704808390fe

image2: fffff704808390fe

MATCH -images are similar.

anytext

from PIL import Image
import imagehash

hash1 = imagehash.average_hash(Image.open('panda.jpg')) 
hash2 = imagehash.average_hash(Image.open('bike.jpg')) 
cutoff = 5

if hash1 - hash2 < cutoff:
  print(hash1)
  print(hash2)
  print('MATCH -images are similar.')
else:
  print('image1 average hash value:', hash1)
  print('image2 average hash value:', hash2)    
  print('NO MATCH - images are not similar !.')

image1: 00189c1e1fb4e080

image2: fffff704808390fe

NO MATCH - images are not similar !

anytext

from PIL import Image
import imagehash

hash1 = imagehash.average_hash(Image.open('panda.jpg')) 
hash2 = imagehash.average_hash(Image.open('panda.jpg')) 
cutoff = 5

if hash1 - hash2 < cutoff:
  print(hash1)
  print(hash2)
  print('MATCH -images are similar.')
else:
  print('image1 average hash value:', hash1)
  print('image2 average hash value:', hash2)    
  print('NO MATCH - images are not similar !.')
  

image1: 00189c1e1fb4e080

image1: 00189c1e1fb4e080

MATCH -images are similar


Compare Images - Map Location

You can apply the same for many challanges like detect the change from the images (Pre.jpg and Post.jpg) of the same map location.


Python data mining examples



any suggestions or feedback write to me here