Created
November 24, 2016 17:24
-
-
Save Visgean/485ffd313c4059714a74e7a4c0e561ec to your computer and use it in GitHub Desktop.
This file contains hidden or 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
treshold = 100 | |
matrix = [] | |
with open('image-brightness-values.csv') as csv_file: | |
for line in csv_file.readlines(): | |
matrix.append(map(int, line.split(','))) | |
def process_line(line): | |
pairs = zip(line, line[1:]) | |
sub = lambda (x, y): abs(x-y) | |
diffs = map(sub, pairs) | |
return [ | |
'-' if d < treshold else '|' | |
for d in diffs | |
] | |
edges = map(process_line, matrix) | |
for l in edges: | |
print ' '.join(l) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment