Clear Filters
Clear Filters

Plot middle of two lines (Hough Transform)

2 views (last 30 days)
Antonio Stankoski
Antonio Stankoski on 16 Jan 2019
Edited: Geoff Hayes on 17 Jan 2019
My program is detecting the desired lines
But how do i plot the middle of them lines.
Program is plotting lines (green), start point (yellow), end point (red)
% Hough Transform
[H,theta,rho] = hough(filled_a_image);
P = houghpeaks(H,2,'threshold',ceil(0.3*max(H(:))));
lines = houghlines(filled_a_image,theta,rho,P,'FillGap',5,'MinLength',10);
figure, imshow(filled_a_image), hold on
max_len = 0;
for k = 1:length(lines)
xy = [lines(k).point1; lines(k).point2];
plot(xy(:,1),xy(:,2),'LineWidth',1,'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');

Answers (0)

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!