houghpeaks() - Image Processing
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
matrix that holds the row and column coordinates of the peaks.peaks = houghpeaks(___,Name,Value,...) locates
peaks in the Hough transform matrix, where named parameters control
aspects of the operation.Code Generation support:
Yes.MATLAB Function Block support:
Yes.
Syntax
peaks = houghpeaks(H,numpeaks) examplepeaks = houghpeaks(___,Name,Value,...)
Example
Locate and Display Peaks in Hough Transform of Rotated ImageOpen This Example
Read image into workspace.I = imread('circuit.tif');
Create binary image.BW = edge(imrotate(I,50,'crop'),'canny');
Create Hough transform of image.[H,T,R] = hough(BW);
Find peaks in the Hough transform of the image and plot them.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');
Output / Return Value
Limitations
Alternatives / See Also
Reference