X-Git-Url: http://git.tomasm.cz/imago.git/blobdiff_plain/f662aac90eb7fb03ddca08366b83f0fd063b9e86..ca969217d6512b175f6a63d36e3ac34c0e610d2f:/imago_pack/linef.py diff --git a/imago_pack/linef.py b/imago_pack/linef.py index 06483a3..b098257 100644 --- a/imago_pack/linef.py +++ b/imago_pack/linef.py @@ -13,23 +13,14 @@ except ImportError, msg: 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") @@ -37,7 +28,22 @@ def find_lines(image, show_all, do_something, verbose): 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"