Image Processing Toolbox User's Guide |
Identify peaks in the Hough transform
Syntax
Description
peaks = houghpeaks(H,numpeaks)
locates peaks in the Hough transform matrix, H, generated by the hough
function. numpeaks
specifies the maximum number of peaks to identify.
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. If numpeaks is omitted, it defaults to 1.
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.
Class Support
H is the output of the hough
function. numpeaks
is a positive integer scalar.
Example
Locate and display two peaks in the Hough transform of the rotated circuit.tif 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');
See also
houghlines | hsv2rgb |
© 1994-2005 The MathWorks, Inc.