diff --git a/skimage/transform/hough_transform.py b/skimage/transform/hough_transform.py index 200aa5dc..7e853f06 100644 --- a/skimage/transform/hough_transform.py +++ b/skimage/transform/hough_transform.py @@ -132,8 +132,9 @@ def hough_circle(image, radius, normalize=True, full_output=False): ---------- image : (M, N) ndarray Input image with nonzero values representing edges. - radius : ndarray + radius : scalar or sequence of scalars Radii at which to compute the Hough transform. + Floats are converted to integers. normalize : boolean, optional (default True) Normalize the accumulator with the number of pixels used to draw the radius. @@ -163,5 +164,7 @@ def hough_circle(image, radius, normalize=True, full_output=False): (25, 35, 23) """ + + radius = np.atleast_1d(np.asarray(radius)) return _hough_circle(image, radius.astype(np.intp), normalize=normalize, full_output=full_output) diff --git a/skimage/transform/tests/test_hough_transform.py b/skimage/transform/tests/test_hough_transform.py index e7030494..fce7013c 100644 --- a/skimage/transform/tests/test_hough_transform.py +++ b/skimage/transform/tests/test_hough_transform.py @@ -140,8 +140,11 @@ def test_hough_circle(): y, x = circle_perimeter(y_0, x_0, radius) img[x, y] = 1 + out1 = tf.hough_circle(img, radius) + out2 = tf.hough_circle(img, [radius]) + assert_equal(out1, out2) out = tf.hough_circle(img, np.array([radius], dtype=np.intp)) - + assert_equal(out, out1) x, y = np.where(out[0] == out[0].max()) assert_equal(x[0], x_0) assert_equal(y[0], y_0)