## Documentation Center |

Identify peaks in Hough transform

`peaks = houghpeaks(H, numpeaks)peaks = houghpeaks(..., param1, val1,
param2, val2)`

`peaks = houghpeaks(H, numpeaks)` locates
peaks in the Hough transform matrix, `H`, generated
by the `hough` function. `numpeaks` is
a scalar value that specifies the maximum number of peaks to identify.
If you omit `numpeaks`, it defaults to 1.

The function returns `peaks`, a Q-by-2 matrix,
where Q can range from 0 to `numpeaks`. Q holds the
row and column coordinates of the peaks.

`peaks = houghpeaks(..., param1, val1,
param2, val2)` specifies parameter/value pairs, listed in
the following table. Parameter names can be abbreviated, and case
does not matter.

Parameter | Description |
---|---|

| Nonnegative scalar value that specifies the threshold
at which values of |

| Two-element vector of positive odd integers: |

Locate and display two peaks in the Hough transform of a rotated image.

I = imread('circuit.tif'); BW = edge(imrotate(I,50,'crop'),'canny'); [H,T,R] = hough(BW); P = houghpeaks(H,2); imshow(H,[],'XData',T,'YData',R,'InitialMagnification','fit'); xlabel('\theta'), ylabel('\rho'); axis on, axis normal, hold on; plot(T(P(:,2)),R(P(:,1)),'s','color','white');

Was this topic helpful?