{ } Raw JSON

bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / transform / hough_transform / hough_ellipse

function

skimage.transform.hough_transform:hough_ellipse

source: /dev/scikit-image/src/skimage/transform/hough_transform.py :126

Signature

def   hough_ellipse ( image threshold = 4 accuracy = 1 min_size = 4 max_size = None )

Summary

Perform an elliptical Hough transform.

Parameters

image : ndarray of shape (M, N)

Input image with nonzero values representing edges.

threshold : int, optional

Accumulator threshold value. A lower value will return more ellipses.

accuracy : double, optional

Bin size on the minor axis used in the accumulator. A higher value will return more ellipses, but lead to a less precise estimation of the minor axis lengths.

min_size : int, optional

Minimal major axis length.

max_size : int, optional

Maximal minor axis length. If None, the value is set to half of the smaller image dimension.

Returns

result : ndarray with fields [(accumulator, yc, xc, a, b, orientation)].

Where (yc, xc) is the center, (a, b) the major and minor axes, respectively. The orientation value follows the skimage.draw.ellipse_perimeter convention.

Notes

Potential ellipses in the image are characterized by their major and minor axis lengths. For any pair of nonzero pixels in the image that are at least half of min_size apart, an accumulator keeps track of the minor axis lengths of potential ellipses formed with all the other nonzero pixels. If any bin (with bin_size = accuracy * accuracy) in the histogram of those accumulated minor axis lengths is above threshold, the corresponding ellipse is added to the results.

A higher accuracy will therefore lead to more ellipses being found in the image, at the cost of a less precise estimation of the minor axis length.

Examples

from skimage.transform import hough_ellipse
from skimage.draw import ellipse_perimeter
img = np.zeros((25, 25), dtype=np.uint8)
rr, cc = ellipse_perimeter(10, 10, 6, 8)
img[cc, rr] = 1
result = hough_ellipse(img, threshold=8)
result.tolist()

Aliases

  • skimage.transform.hough_ellipse