hough变换检测直线,用MATLAB,急~~~~~~~在线等

来源:百度知道 编辑:UC知道 时间:2024/06/07 17:05:11
能直接运行的那种,谢谢啦~~~
我的matlab中没有自带的hough啊~~~

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');

matlab自带的程序。

当然,根据不同图片,要适当修改里面的参数。