installation instructions
[imago.git] / imago.py
index c053a7f..3fa4f6b 100755 (executable)
--- a/imago.py
+++ b/imago.py
@@ -17,6 +17,7 @@ import im_debug
 import linef
 import manual
 import intrsc
+import gridf
 
 def main():
     """Main function of the program."""
@@ -52,7 +53,7 @@ def main():
                               image.size[1])), Image.ANTIALIAS)
     do_something = im_debug.show
     if args.saving:
-        do_something = imsave("saved/" + args.file[0][:-4] + "_" +
+        do_something = imsave("saved/" + args.files[0][:-4] + "_" +
                                str(image.size[0]) + "/").save
 
     if args.manual_mode:
@@ -62,7 +63,14 @@ def main():
             #TODO ask user to try again
             return 1
     else:
-        lines = linef.find_lines(image, show_all, do_something, verbose)
+        lines, l1, l2, bounds, hough = linef.find_lines(image, show_all, do_something, verbose)
+        grid, lines = gridf.find(lines, image.size, l1, l2, bounds, hough, do_something)
+        if show_all:
+            im_g = image.copy()
+            draw = ImageDraw.Draw(im_g)
+            for l in grid[0] + grid[1]:
+                draw.line(l, fill=(64, 255, 64), width=1)
+            do_something(im_g)
 
     board = intrsc.board(image, lines, show_all, do_something)