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
from itertools import permutations | |
def generateNeighbours(point): | |
perm = set(permutations([-1, -1, -1, 0, 0, 1, 1, 1], 3)) | |
return [(point[0] + p[0], point[1] + p[1], point[2] + p[2]) for p in perm] | |
def distance(a, b): | |
return (a[0] - b[0])**2 + (a[1] - b[1])**2 + (a[2] - b[2])**2 |
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
import os | |
from shutil import copyfile | |
types = [] | |
files = [f for f in os.listdir('.') if os.path.isfile(f)] | |
for f in files: | |
ext = f.split('.')[-1] | |
dirr = 'Chategorized/' + ext + "-files" | |
if ext not in types: |
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
from PIL import Image, ImageFilter | |
def getNeighbours(i, j, n, m) : | |
arr = [] | |
if i-1 >= 0 and j-1 >= 0 : | |
arr.append((i-1, j-1)) | |
if i-1 >= 0 : | |
arr.append((i-1, j)) | |
if i-1 >= 0 and j+1 < m : | |
arr.append((i-1, j+1)) |