www.gusucode.com > images 案例代码 matlab源码程序 > images/LocateAndDisplayPeaksInHoughTransformOfRotatedImageExample.m
%% Locate and Display Peaks in Hough Transform of Rotated Image % %% % Read image into workspace. % Copyright 2015 The MathWorks, Inc. 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');