From 531060ec2054f06958f66c90eb37e4c2fdffe95f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Thu, 1 Nov 2012 15:01:14 +0100 Subject: [PATCH] Reduce to one threshold paramater --- skimage/transform/hough_transform.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/skimage/transform/hough_transform.py b/skimage/transform/hough_transform.py index 5e77954d..3c27e346 100644 --- a/skimage/transform/hough_transform.py +++ b/skimage/transform/hough_transform.py @@ -139,7 +139,7 @@ def hough(img, theta=None): def hough_peaks(hspace, angles, dists, min_distance=10, min_angle=10, - threshold_abs=0, threshold_rel=0.5, num_peaks=np.inf): + threshold=None, num_peaks=np.inf): """Return peaks in hough transform. Identifies most prominent lines separated by a certain angle and distance in @@ -162,10 +162,8 @@ def hough_peaks(hspace, angles, dists, min_distance=10, min_angle=10, min_angle : int Minimum angle separating lines (maximum filter size for second dimension of hough space). - threshold_abs : float - Minimum intensity of peaks in hough space. - threshold_rel : float - Minimum intensity of peaks calculated as `max(hspace) * threshold_rel`. + threshold : float + Minimum intensity of peaks calculated as `0.5 * max(hspace)`. num_peaks : int Maximum number of peaks. When the number of peaks exceeds `num_peaks`, return `num_peaks` coordinates based on peak intensity. @@ -197,7 +195,8 @@ def hough_peaks(hspace, angles, dists, min_distance=10, min_angle=10, hspace = hspace.copy() rows, cols = hspace.shape - threshold = max(threshold_abs, threshold_rel * np.max(hspace)) + if threshold is None: + threshold = 0.5 * np.max(hspace) distance_size = 2 * min_distance + 1 angle_size = 2 * min_angle + 1