skimage2.transform.hough_line_peaks#
- skimage2.transform.hough_line_peaks(hspace, angles, dists, min_distance=9, min_angle=10, threshold=None, num_peaks=inf)[source]#
Return peaks in a straight line 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:
- hspacendarray, shape (M, N)
Hough space returned by the
hough_linefunction.- anglesarray, shape (N,)
Angles returned by the
hough_linefunction. Assumed to be continuous. (angles[-1] - angles[0] == PI).- distsarray, shape (M,)
Distances returned by the
hough_linefunction.- min_distanceint, optional
Minimum distance separating lines (maximum filter size for first dimension of hough space).
- min_angleint, optional
Minimum angle separating lines (maximum filter size for second dimension of hough space).
- thresholdfloat, optional
Minimum intensity of peaks. Default is
0.5 * max(hspace).- num_peaksint, optional
Maximum number of peaks. When the number of peaks exceeds
num_peaks, returnnum_peakscoordinates based on peak intensity.
- Returns:
- accum, angles, diststuple of array
Peak values in Hough space, angles and distances.
Examples
>>> from _skimage2.transform import hough_line, hough_line_peaks >>> from _skimage2.draw import line >>> img = np.zeros((15, 15), dtype=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