Merge pull request #1684 from juliusbierk/hough-circle-input

hough_circle radius accepts scalars and lists
This commit is contained in:
Johannes Schönberger
2015-09-02 09:26:25 -04:00
2 changed files with 8 additions and 2 deletions
+4 -1
View File
@@ -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)