第3章_选讲_MATLAB三维绘图功能.ppt

第3章_选讲_MATLAB三维绘图功能

%找出并绘制直线 lines=houghlines(BW,T,R,P,FillGap,5,MinLength,7);%合并距离小于5的线段,丢弃所有长度小于7的直线段 subplot(224),imshow(rotI),hold on for k = 1:length(lines)%依次标出各条直线段 xy=[lines(k).point1;lines(k).point2]; plot(xy(:,1),xy(:,2),x,LineWidth,2,Color,green); %绘制线段端点 plot(xy(1,1),xy(1,2),x,LineWidth,2,Color,yellow); plot(xy(2,1),xy(2,2),x,LineWidth,2,Color,red); %确定最长的线段 len=norm(lines(k).point1-lines(k).point2); if(lenmax_len) max_len=len; xy_long=xy; end end %高亮显示最长线段 plot(xy_long(:,1),xy_long(:,2),LineWidth,2,Color,cyan); 该程序首先读取一幅图像,将其旋转33度,如左上图所示;然后使用

文档评论(0)

1亿VIP精品文档

相关文档