Skip to content

Instantly share code, notes, and snippets.

@kphrx
Created May 23, 2017 15:58
Show Gist options
  • Save kphrx/26379c1beb77cfdefde4ef356afac0c2 to your computer and use it in GitHub Desktop.
Save kphrx/26379c1beb77cfdefde4ef356afac0c2 to your computer and use it in GitHub Desktop.
# coding: utf-8
import sys
import os
import itertools
import pypuzzle
from glob import glob
puzzle = pypuzzle.Puzzle()
flist = []
cflist = []
dl = []
dirname = sys.argv[1]
for e in ['png', 'jpg']:
flist.extend(glob('%s/*.%s'%(dirname,e)))
for fn in itertools.combinations(flist, 2):
cflist.append(list(fn))
for cf in cflist:
# Get distance between two image files
distance = puzzle.get_distance_from_file(cf[0], cf[1])
if distance < 0.1:
dl.append(distance, i)
print(dl)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment