if verbose:
print >> sys.stderr, "edge detection"
- im_edges = filters.edge_detection(im_l)
+ im_edges = filters.edge_detection(im_l, 2)
if show_all:
do_something(im_edges, "edge detection")
if show_all:
do_something(im_h2, "second high pass filters")
- im_h2 = filters.components(im_h2)
+ im_h2 = filters.components2(im_h2)
if show_all:
do_something(im_h2, "components centers")
draw = ImageDraw.Draw(im_line)
line_points = set()
for line in line_l:
- draw.line(line_from_angl_dist(line, im_h2.size), fill=255, width=5)
- draw_c.line(line_from_angl_dist(line, im_c.size), fill=(70, 70, 70), width=5)
+ draw.line(line_from_angl_dist(line, im_h2.size), fill=255, width=7)
+ draw_c.line(line_from_angl_dist(line, im_c.size), fill=(70, 70, 70), width=7)
for p in combine(im_h2, im_line):
line_points.add(p)
for point in line_points:
suma = 0.
for i in range(-2, 3):
for j in range(-2, 3):
- suma += sum(image.getpixel((x + i, y + j)))
+ try:
+ suma += sum(image.getpixel((x + i, y + j)))
+ except IndexError:
+ pass
suma /= 3 * 25
if suma < 55:
return 'B'
if abs(angl1 - angl2) > 0.4:
x = - ((dist2 / math.cos(angl2))-(dist1 / math.cos(angl1))) / (math.tan(angl1) - math.tan(angl2))
y = (math.tan(angl1) * x) - (dist1 / math.cos(angl1))
- line.append((int(x + size[0] / 2), int(y + size[1] / 2)))
+ if (-size[0] / 2 < x < size[0] / 2 and
+ -size[1] / 2 < y < size[1] / 2):
+ line.append((int(x + size[0] / 2), int(y + size[1] / 2)))
intersections.append(line)
return intersections