From 0e4d10775483ec183b31ab02a0778f341b35da59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Boulogne?= Date: Sun, 24 Mar 2013 15:39:07 +0100 Subject: [PATCH] fix signature --- skimage/transform/_hough_transform.pyx | 10 +++++----- skimage/transform/hough_transform.py | 3 ++- skimage/transform/tests/test_hough_transform.py | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/skimage/transform/_hough_transform.pyx b/skimage/transform/_hough_transform.pyx index a8dabcfc..2d5d0230 100644 --- a/skimage/transform/_hough_transform.pyx +++ b/skimage/transform/_hough_transform.pyx @@ -174,8 +174,8 @@ def hough_line(cnp.ndarray img, cnp.ndarray[ndim=1, dtype=cnp.double_t] theta=No return accum, theta, bins -def probabilistic_hough_line(cnp.ndarray img, int value_threshold, - int line_length, int line_gap, +def probabilistic_hough_line(cnp.ndarray img, int threshold=10, + int line_length=50, int line_gap=10, cnp.ndarray[ndim=1, dtype=cnp.double_t] theta=None): """Return lines from a progressive probabilistic line Hough transform. @@ -183,7 +183,7 @@ def probabilistic_hough_line(cnp.ndarray img, int value_threshold, ---------- img : (M, N) ndarray Input image with nonzero values representing edges. - threshold : int + threshold : int, optional (default 10) Threshold line_length : int, optional (default 50) Minimum accepted length of detected lines. @@ -267,7 +267,7 @@ def probabilistic_hough_line(cnp.ndarray img, int value_threshold, continue value = 0 - max_value = value_threshold - 1 + max_value = threshold - 1 max_theta = -1 # apply hough transform on point @@ -278,7 +278,7 @@ def probabilistic_hough_line(cnp.ndarray img, int value_threshold, if value > max_value: max_value = value max_theta = j - if max_value < value_threshold: + if max_value < threshold: continue # from the random point walk in opposite directions and find line diff --git a/skimage/transform/hough_transform.py b/skimage/transform/hough_transform.py index 8e680c94..1b356127 100644 --- a/skimage/transform/hough_transform.py +++ b/skimage/transform/hough_transform.py @@ -17,7 +17,8 @@ def hough(img, theta=None): @deprecated('probabilistic_hough') def probabilistic_hough(img, threshold=10, line_length=50, line_gap=10, theta=None): - return probabilistic_hough_line(img, threshold, line_length, line_gap, theta) + return probabilistic_hough_line(img, threshold=threshold, + line_length=line_length, line_gap=line_gap, theta=theta) @deprecated('hough_peaks') def hough_peaks(hspace, angles, dists, min_distance=10, min_angle=10, diff --git a/skimage/transform/tests/test_hough_transform.py b/skimage/transform/tests/test_hough_transform.py index 2a2f57d2..395e6faa 100644 --- a/skimage/transform/tests/test_hough_transform.py +++ b/skimage/transform/tests/test_hough_transform.py @@ -49,8 +49,8 @@ def test_probabilistic_hough(): # decrease default theta sampling because similar orientations may confuse # as mentioned in article of Galambos et al theta = np.linspace(0, np.pi, 45) - lines = tf.probabilistic_hough_line(img, theta=theta, threshold=10, line_length=10, - line_gap=1) + lines = tf.probabilistic_hough_line(img, threshold=10, line_length=10, + line_gap=1, theta=theta) # sort the lines according to the x-axis sorted_lines = [] for line in lines: