X-Git-Url: http://git.tomasm.cz/imago.git/blobdiff_plain/a0ffea12425b22e87010c097a393e9b627eb0a29..f38e3d7e4b084d293dcf80c63b812d98613a9c7b:/imago.py diff --git a/imago.py b/imago.py index 810aa53..830a53b 100755 --- a/imago.py +++ b/imago.py @@ -16,6 +16,7 @@ except ImportError, msg: import im_debug import linef +import manual def main(): """Main function of the program.""" @@ -25,6 +26,8 @@ def main(): help="image to analyse") parser.add_argument('-w', type=int, default=640, help="scale image to the specified width before analysis") + parser.add_argument('-m', '--manual', dest='manual_mode', action='store_true', + help="manual grid selection") parser.add_argument('-d', '--debug', dest='show_all', action='store_true', help="show every step of the computation") parser.add_argument('-s', '--save', dest='saving', action='store_true', @@ -51,8 +54,15 @@ def main(): if args.saving: do_something = imsave("saved/" + args.file[0][:-4] + "_" + str(image.size[0]) + "/").save - - lines = linef.find_lines(image, show_all, do_something, verbose) + + if args.manual_mode: + try: + lines = manual.find_lines(image) + except manual.UserQuitError: + #TODO ask user to try again + return 1 + else: + lines = linef.find_lines(image, show_all, do_something, verbose) intersections = intersections_from_angl_dist(lines, image.size) image_g = image.copy()