資源簡介
基于matlab的hough變換。想了解霍夫變換詳細過程的朋友可以下下來看看!!這個程序以直線為例,詳細闡述了霍夫變換的直線檢測功能。
代碼片段和文件信息
%?Hough?變換
i=imread(‘test.bmp‘);
i=rgb2gray(i);
i_long?=size(i1);
i_width=size(i2);
i_edge=edge(i‘robert‘);
i_hough=zeros(300300);
theta_step=3.14*2/299;
theta=0:theta_step:2*3.14;
x_max=1;
x_min=1;
y_max=1;
y_min=1;
for?x=1:i_long
????for?y=1:i_width
????????if?i_edge(xy)==1
????????????x_max=max(x_maxx);
????????????x_min=min(x_minx);
????????????y_max=max(y_maxy);
????????????y_min=min(y_miny);
????????end
????end
end
p_min=sqrt(x_min^2+y_min^2);
p_max=sqrt(x_max^2+y_max^2);
p_step=2*p_max/299;
p=-p_max:p_step:p_max;
for?x=1:i_long
????for?y=1:i_width
????????if?i_edge(xy)==1?????%對于邊緣點進行累加
???????????rou=x.*cos(theta)+y.*sin(theta);
????????????w=fix(rou./p_step)+151;
????????????l=fix(1+theta./theta_step);
????????????n=300.*(l-1)+w;
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????949??2009-07-23?18:36??Hough\hough.m
?????文件??????31056??2006-01-11?17:33??Hough\HOUGH變換.jpg
?????目錄??????????0??2006-01-17?00:21??Hough
-----------?---------??----------?-----??----
????????????????32005????????????????????3
評論
共有 條評論