hough-line-peaks

hough_line_peaks

skimage.transform.hough_line_peaks(hspace, angles, dists, min_distance=9, min_angle=10, threshold=None, num_peaks=inf) [source]

Return peaks in hough transform.

Identifies most prominent lines separated by a certain angle and distance in a hough transform. Non-maximum suppression with different sizes is applied separately in the first (distances) and second (angles) dimension of the hough space to identify peaks.

Parameters:

hspace : (N, M) array

Hough space returned by the hough_line function.

angles : (M,) array

Angles returned by the hough_line function. Assumed to be continuous. (angles[-1] - angles[0] == PI).

dists : (N, ) array

Distances returned by the hough_line function.

min_distance : int

Minimum distance separating lines (maximum filter size for first dimension of hough space).

min_angle : int

Minimum angle separating lines (maximum filter size for second dimension of hough space).

threshold : float

Minimum intensity of peaks. Default is 0.5 * max(hspace).

num_peaks : int

Maximum number of peaks. When the number of peaks exceeds num_peaks, return num_peaks coordinates based on peak intensity.

Returns:

hspace, angles, dists : tuple of array

Peak values in hough space, angles and distances.

Examples

>>> from skimage.transform import hough_line, hough_line_peaks
>>> from skimage.draw import line
>>> img = np.zeros((15, 15), dtype=np.bool_)
>>> rr, cc = line(0, 0, 14, 14)
>>> img[rr, cc] = 1
>>> rr, cc = line(0, 14, 14, 0)
>>> img[cc, rr] = 1
>>> hspace, angles, dists = hough_line(img)
>>> hspace, angles, dists = hough_line_peaks(hspace, angles, dists)
>>> len(angles)
2
doc_scikit_image
2017-01-12 17:21:17
Comments
Leave a Comment

Please login to continue.