How can apply the Hough transform to detect lines in an images?
1 回表示 (過去 30 日間)
古いコメントを表示
%% Find lines and plot them lines = houghlines(imEdge,T,R,P,'FillGap',30,'MinLength',15); figure, imshow(im), hold on max_len = 0; for k = 1:length(lines) xy = [lines(k).point1; lines(k).point2]; plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','green');
% Plot beginnings and ends of lines
plot(xy(1,1),xy(1,2),'x','LineWidth',2,'Color','yellow');
plot(xy(2,1),xy(2,2),'x','LineWidth',2,'Color','red');
% Determine the endpoints of the longest line segment
len = norm(lines(k).point1 - lines(k).point2);
if ( len > max_len)
max_len = len;
xy_long = xy;
end
end
%imclearborder
% highlight the longest line segment
plot(xy_long(:,1),xy_long(:,2),'LineWidth',2,'Col

0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Computer Vision with Simulink についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!