why hough can't detect the lane line

1 回表示 (過去 30 日間)
Jun Zhang
Jun Zhang 2019 年 5 月 1 日
VehicleTest_2019-04-30T204830.jpg
I try to use hough to detect the line , the right line was missing. how to solve it?
see the result
1.png
the hough detect result
2.png
code is as following
grapy_pic=rgb2gray(pic);
edge_pic=edge(grapy_pic,'canny',[0.05 0.35]);
imshow(edge_pic)
shape=size(pic);
% row coordinate
a=[shape(2)*0 shape(2)*1 shape(2)*1 0];
%column corordinate
b=[shape(1)*0.05 shape(1)*0.05 shape(1)*0.65 shape(1)*0.65 ];
%use a,b to specify the interesting area
bw=roipoly(pic,a,b);
BW=(edge_pic(:,:,1) & bw);
imshow(BW)
hold on
plot(a, b)
hold off
[H, T, R]=hough(BW') %,'RhoResolution', 1, 'ThetaResolution', 1);
P=houghpeaks(H,5);%'threshold');%,ceil(0.6*max(H(:))));
lines=houghlines(BW,T,R,P,'FillGap',4,'MinLength',5);
imagesc(pic);
hold on;
%plot(lines(5).point1(1),lines(5).point1(2),'rd')
for i=1:length(lines)
plot([lines(i).point1(1),lines(i).point2(1)],[lines(i).point1(2),lines(i).point2(2)],'Color','blue','LineWidth',4)
end
hold off

回答 (0 件)

タグ

製品


リリース

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by