膨胀和腐蚀,radon,hough变换.pptVIP

  • 3
  • 0
  • 约2.93千字
  • 约 42页
  • 2017-04-24 发布于四川
  • 举报
膨胀和腐蚀,radon,hough变换

;;;;;;;;其他算子的运算规则都与上面所述相同。运算结果与原图像有关,算子形状与图像的邻域情况决定了运算结果。 另外,从上面描述情况看,二值图像膨胀运算本质上是逻辑运算。 数学上,二值图像膨胀运算可以用集合定义如下:;;【例3-17】对二值图像实施腐蚀运算。 把3-16中程序语句: C1=imdilate(B,M); C2=imdilate(B,N); C3=imdilate(B,P); C4=imdilate(B,Q); 修改为: C1=imerode(B,M);C2=imerode(B,N); C3=imerode(B,P);C4=imerode(B,Q); 其他语句不变,程序运行的结果是图3-20。 ;;;;;;;;;;;;;;例e1;例 clear; I=zeros(200,200); A=eye(100,100); I(101:200,1:100)=A; figure, imshow(I);title(orginal image); theta=0:180; [R,xp]=radon(I,theta); figure,imagesc(theta,xp,R); title(R_theta X); xlabel(theta(degree)); ylabel(X\prime); colormap(hot); colorbar; 所求?=45度,X`=-75左右。意思是在原XY坐标下的45度的直线X`上,距离原点75的???置有条与X`垂直的直线。此直线真正的45+90=135度,右移-75/sin45=100的距离。 ;;;;;4.6 Hough变换;1.直线检测的意义;2.Hough变换原理及特点;3.直线的Hough变换的基本思想;在参数a-b平面上相交直线最多的点,对应的x-y平面上的直线就是我们的解 上述在x-y坐标中用斜率描述的直线存在斜率a无穷大的情况,会给计算带来不便。故一般采用下面的点-正弦曲线对偶。 ;点-正弦曲线对偶( ? =xcos ? + ysin? ) 采用极坐标描述直线,则有如下的Hough变换函数: ? =xcos ? + ysin? 即将图像空间中的点(x,y)影射到?- ?参数空间。 ;I1 = imread(D:\0066.jpg); I=rgb2gray(I1); BW = edge(I,canny); [H,T,R] = hough(BW); imshow(H,[],XData,T,YData,R,InitialMagnification,fit); axis normal, hold on; P = houghpeaks(H,5); x = T(P(:,2)); y = R(P(:,1)); plot(x,y,s,color,white); lines = houghlines(BW,T,R,P); figure, imshow(I), hold on max_len = 0; for k = 1:length(lines) xy = [lines(k).point1; lines(k).point2]; plot(xy(:,1),xy(:,2),Color,green); plot(xy(1,1),xy(1,2),Color,yellow); plot(xy(2,1),xy(2,2),Color,red); len = norm(lines(k).point1 - lines(k).point2); if ( len max_len) max_len = len; xy_long = xy; end end plot(xy_long(:,1),xy_long(:,2),Color,cyan);;[H, theta, rho] = hough(bw)函数;peaks = houghpeaks(H,numpeaks)函数;;I = imread(circuit.tif); rotI = imrotate(I,33,crop); BW = edge(rotI,canny); [H,T,R] = hough(BW); imshow(H,[],XData,T,YData,R,InitialMagnification,fit);

文档评论(0)

1亿VIP精品文档

相关文档