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]
+ 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]))
pix = 0
new_image_l[x, y] = pix
return new_image
+
+def peaks(image):
+ image_l = image.load()
+ new_image = Image.new('L', image.size)
+ new_image_l = new_image.load()
+ clear()
+ print "peak extraction"
+ 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)])
+ + (16 * image_l[x, y]))
+ if pix > 255:
+ pix = 255
+ if pix < 0:
+ pix = 0
+ new_image_l[x, y] = pix
+ return new_image
def high_pass(image, height):
image_l = image.load()
im_hough = hough1.transform(im_h)
if show_all:
do_something(im_hough, "hough transform")
+
+ im_hough = filters.peaks(im_hough)
+ if show_all:
+ do_something(im_hough, "peak extraction")
im_h2 = filters.high_pass(im_hough, 120)
if show_all: