mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-19 11:27:45 +08:00
Merge pull request #1684 from juliusbierk/hough-circle-input
hough_circle radius accepts scalars and lists
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user