import filters
from hough import Hough
-def find_lines(image, show_all, do_something, verbose):
- """Find lines in the *image*."""
- # TODO refactor into smaller functions
-
- if verbose:
- print >> sys.stderr, "preprocessing"
-
- if show_all:
- do_something(image, "original image")
-
+def prepare(image, show_all, do_something, verbose):
+ # TODO comment
im_l = image.convert('L')
if show_all:
do_something(im_l, "ITU-R 601-2 luma transform")
if verbose:
print >> sys.stderr, "edge detection"
-
im_edges = filters.edge_detection(im_l)
if show_all:
do_something(im_edges, "edge detection")
im_h = filters.high_pass(im_edges, 100)
if show_all:
do_something(im_h, "high pass filters")
-
+
+ return im_h
+
+
+def find_lines(image, show_all, do_something, verbose):
+ """Find lines in the *image*."""
+ # TODO refactor into smaller functions
+
+ if verbose:
+ print >> sys.stderr, "preprocessing"
+
+ if show_all:
+ do_something(image, "original image")
+
+ im_h = prepare(image, show_all, do_something, verbose)
+
if verbose:
print >> sys.stderr, "hough transform"