From 941cdda8f58165ed81ef853e44d126c9b1a5d5f5 Mon Sep 17 00:00:00 2001 From: Kevin Keraudren Date: Sat, 30 May 2015 20:47:37 +0100 Subject: [PATCH 1/2] the output of hough_ellipse needs to be rounded before being truncated --- doc/examples/plot_circular_elliptical_hough_transform.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/examples/plot_circular_elliptical_hough_transform.py b/doc/examples/plot_circular_elliptical_hough_transform.py index 3d24e57c..5439bc35 100755 --- a/doc/examples/plot_circular_elliptical_hough_transform.py +++ b/doc/examples/plot_circular_elliptical_hough_transform.py @@ -128,10 +128,10 @@ result.sort(order='accumulator') # Estimated parameters for the ellipse best = result[-1] -yc = int(best[1]) -xc = int(best[2]) -a = int(best[3]) -b = int(best[4]) +yc = int(round(best[1])) +xc = int(round(best[2])) +a = int(round(best[3])) +b = int(round(best[4])) orientation = best[5] # Draw the ellipse on the original image From 4dfa467c34270b84f1e40e1297200989bc7dbef4 Mon Sep 17 00:00:00 2001 From: Kevin Keraudren Date: Sun, 31 May 2015 15:25:41 +0100 Subject: [PATCH 2/2] code simplification --- doc/examples/plot_circular_elliptical_hough_transform.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/doc/examples/plot_circular_elliptical_hough_transform.py b/doc/examples/plot_circular_elliptical_hough_transform.py index 5439bc35..1d36e1b8 100755 --- a/doc/examples/plot_circular_elliptical_hough_transform.py +++ b/doc/examples/plot_circular_elliptical_hough_transform.py @@ -127,11 +127,8 @@ result = hough_ellipse(edges, accuracy=20, threshold=250, result.sort(order='accumulator') # Estimated parameters for the ellipse -best = result[-1] -yc = int(round(best[1])) -xc = int(round(best[2])) -a = int(round(best[3])) -b = int(round(best[4])) +best = list(result[-1]) +yc, xc, a, b = [int(round(x)) for x in best[1:5]] orientation = best[5] # Draw the ellipse on the original image