- hough1 = Hough(im_h.size)
- 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:
- do_something(im_h2, "second high pass filters")
-
- im_h2 = filters.components(im_h2)
- if show_all:
- do_something(im_h2, "components centers")
-
- hough2 = Hough(im_h2.size)
- im_hough2 = hough2.transform(im_h2)
- if show_all:
- do_something(im_hough2, "second hough transform")
-
- im_h3 = filters.high_pass(im_hough2, 120)
- if show_all:
- do_something(im_h3, "third high pass filters")
-
- lines = hough2.find_angle_distance(im_h3)
-
- im_lines = Image.new('L', im_h2.size)
-
- draw = ImageDraw.Draw(im_lines)
-
- for line in lines:
- draw.line(line_from_angl_dist(line, im_h2.size), fill=255, width=5)
- if show_all:
- do_something(im_lines, "lines")
-
- im_c = combine(im_h2, im_lines)
- if show_all:
- do_something(im_c, "first hough x lines")
-
- collapse(im_c)
- if show_all:
- do_something(im_c, "optimalised hough")
-
- lines = hough1.all_lines(im_c)
- draw = ImageDraw.Draw(image)
- for line in lines:
- draw.line(line_from_angl_dist(line, image.size), fill=(120, 255, 120))
-
- do_something(image, "the grid")
+ if len(args.files) > 1:
+ for f in args.files[1:]:
+ try:
+ image = Image.open(f)
+ except IOError, msg:
+ print >> sys.stderr, msg
+ continue
+ if image.mode == 'P':
+ image = image.convert('RGB')
+ board = intrsc.board(image, lines, show_all, do_something)
+ for line in board:
+ print ' '.join(line)