X-Git-Url: http://git.tomasm.cz/imago.git/blobdiff_plain/3c7eb1408a615d8bdc5e85c04f90c45d620d1e48..15a3ebaaddc23a2f69048d1def5a7f960d141d6b:/filter.py diff --git a/filter.py b/filter.py index 7421fea..c350ef5 100644 --- a/filter.py +++ b/filter.py @@ -1,9 +1,12 @@ from PIL import Image +from commons import clear def edge_detection(image): image_l = image.load() new_image = Image.new('L', image.size) new_image_l = new_image.load() + clear() + print "edge detection" for x in range(2, image.size[0] - 2): for y in range(2, image.size[1] - 2): pix = sum([sum([image_l[a, b] for b in range(y - 2, y + 3)]) for a in range(x - 2, x + 3)]) - (25 * image_l[x, y]) @@ -18,8 +21,10 @@ def high_pass(image, high_pass): image_l = image.load() new_image = Image.new('L', image.size) new_image_l = new_image.load() - for x in range(image.size[0]): - for y in range(image.size[1]): + clear() + print "high pass filter" + for x in xrange(image.size[0]): + for y in xrange(image.size[1]): if image_l[x, y] < high_pass: new_image_l[x, y] = 0 else: