X-Git-Url: http://git.tomasm.cz/imago.git/blobdiff_plain/841662dc25b40dce151a0bf7a024e55682028f18..78ff145bbc5a1323c889b174d0f93ab30bfc0efe:/src/linef.py?ds=sidebyside diff --git a/src/linef.py b/src/linef.py index ab7c95d..aa9921b 100644 --- a/src/linef.py +++ b/src/linef.py @@ -5,7 +5,7 @@ import sys 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) @@ -33,10 +33,10 @@ def transform(image, hough, show_image): im_hough = hough.transform(image) show_image(im_hough, "hough transform") - # im_hough.image = filters.peaks(im_hough.image) - # show_image(im_hough.image, "peak extraction") + # im_hough = filters.peaks(im_hough) + # show_image(im_hough, "peak extraction") - im_h2 = filters.high_pass(im_hough, 96) + im_h2 = filters.high_pass(im_hough, 128) show_image(im_h2, "second high pass filters") im_h2 = filters.components(im_h2, 2) @@ -58,7 +58,7 @@ def run_ransac(image): data.append((x, y)) dist = 3 - (line, points), (line2, points2) = ransac.ransac_duo(data, dist, 75, 15) + [(line, points), (line2, points2)] = ransac.ransac_multi(2, data, dist, 250) line_to_points = lambda (a, b, c), x: (x, (a*x + c) / (- b)) # TODO width should not be here vvv # TODO refactor gridf to use standard equations instead of points