skimage2.transform.hough_circle#

skimage2.transform.hough_circle(image, radius, normalize=True, full_output=False)[source]#

Perform a circular Hough transform.

Parameters:
imagendarray, shape (M, N)

Input image with nonzero values representing edges.

radiusscalar or sequence of scalars

Radii at which to compute the Hough transform. Floats are converted to integers.

normalizebool, optional

Normalize the accumulator with the number of pixels used to draw the radius.

full_outputbool, optional

Extend the output size by twice the largest radius in order to detect centers outside the input picture.

Returns:
Hndarray, shape (radius index, M + 2R, N + 2R)

Hough transform accumulator for each radius. R designates the larger radius if full_output is True. Otherwise, R = 0.

Examples

>>> from _skimage2.transform import hough_circle
>>> from _skimage2.draw import circle_perimeter
>>> img = np.zeros((100, 100), dtype=bool)
>>> rr, cc = circle_perimeter(25, 35, 23)
>>> img[rr, cc] = 1
>>> try_radii = np.arange(5, 50)
>>> res = hough_circle(img, try_radii)
>>> ridx, r, c = np.unravel_index(np.argmax(res), res.shape)
>>> r, c, try_radii[ridx]
(25, 35, 23)