霍夫变换实现直线检测——MATLAB
网上好多不能用,就重新写了一个:
% 入口图像为 BW,出口图像为fclc,closeBW=imread('D:\picture\9dafa605d53eea243812bb29.jpg');BW=rgb2gray(BW);thresh=[0.01,0.17];sigma=2;%定义高斯参数f = edge(double(BW),'canny',thresh,sigma);figure(1),imshow(f,[]);title('canny 边缘检测');[H, theta, rho]= hough(f, 0.5);%imshow(theta,rho,H,[],'notruesize'),axis on,axis normal%xlabel('\theta'),ylabel('rho'<