分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow
也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!
在上一篇博客中发现经过霍夫变换检测出的直线有可能因为车辆挡住路沿等原因断开,形成线段,这样就不好了,因为检测道路是要找直线焦点。
Thus it is necessary to combine 相同斜率的直线 and connect them.
本代码提供了matlab下求取经过霍夫变换的直线斜率,并将其联合,代码见下方,实验结果见文末。
% 入口图像为 BW,出口图像为f%optimize from main_optimize, merely select 2 lines, one has positive%slope,the other has negative slopeclear all,close allBW=imread('D:\Images\NEW\img4b9faef664e03.jpg');figure,imshow(BW);BW=rgb2gray(BW);%thresh=[0.01,0.17];thresh=[0.01,0.10];sigma=2;%定义高斯参数f = edge(double(BW),'canny',thresh,sigma);figure