fix split lines in Hough space
[imago.git] / src / linef.py
index 8ebb702..8de87a6 100644 (file)
@@ -5,7 +5,7 @@ import sys
 from math import sin, cos, pi
 
 try:
 from math import sin, cos, pi
 
 try:
-    import Image, ImageDraw
+    from PIL import Image, ImageDraw
 except ImportError, msg:
     print >> sys.stderr, msg
     sys.exit(1)
 except ImportError, msg:
     print >> sys.stderr, msg
     sys.exit(1)
@@ -56,6 +56,8 @@ def run_ransac(image):
         for x in xrange(0, width):
             if image_l[x, y] > 128:
                 data.append((x, y))
         for x in xrange(0, width):
             if image_l[x, y] > 128:
                 data.append((x, y))
+                if y < 30:
+                    data.append((width - x, y + height))
 
     dist = 3 
     [(line, points), (line2, points2)] = ransac.ransac_multi(2, data, dist, 250)
 
     dist = 3 
     [(line, points), (line2, points2)] = ransac.ransac_multi(2, data, dist, 250)