return im_h
+def transform(image, hough, show_all, do_something):
+ im_hough = hough.transform(image)
+ if show_all:
+ do_something(im_hough, "hough transform")
+
+ # im_hough.image = filters.peaks(im_hough.image)
+ # if show_all:
+ # do_something(im_hough.image, "peak extraction")
+
+ im_h2 = filters.high_pass(im_hough, 96)
+ if show_all:
+ do_something(im_h2, "second high pass filters")
+
+ im_h2 = filters.components2(im_h2)
+ if show_all:
+ do_something(im_h2, "components centers")
+
+ return im_h2
def find_lines(image, show_all, do_something, verbose):
"""Find lines in the *image*."""
do_something(image, "original image")
im_h = prepare(image, show_all, do_something, verbose)
-
hough = Hough.default(im_h)
if verbose:
print >> sys.stderr, "hough transform"
-
- im_hough = hough.transform(im_h)
- if show_all:
- do_something(im_hough, "hough transform")
-
- # im_hough.image = filters.peaks(im_hough.image)
- # if show_all:
- # do_something(im_hough.image, "peak extraction")
-
- im_h2 = filters.high_pass(im_hough, 96)
- if show_all:
- do_something(im_h2, "second high pass filters")
-
- im_h2 = filters.components2(im_h2)
- if show_all:
- do_something(im_h2, "components centers")
+
+ im_h2 = transform(im_h, hough, show_all, do_something)
if verbose:
print >> sys.stderr, "second hough transform"