Extracting lines from outer image.
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
uploaded_files/115811/aaa.PNG I have this image. I want to find the lines plotting from outside of the edges so that there will be existence of line intersections. From there I would like to find the angle. Can someone help me with this?
2 Kommentare
Alfonso
am 3 Mai 2018
Do you mean finding the x and y coordinates of the 3 lines which are out of the cyclist?
Antworten (1)
Alfonso
am 3 Mai 2018
Bearbeitet: Alfonso
am 3 Mai 2018
An option would be using bwboundaries which obtains all the boundaries in the image.
the variable boundary outputs the amount of existing boundaries, in your case there are 32, you can try to plot each one until you find the ones corresponding to the outer lines.
imshow(img_bin)
boundary=bwboundaries(img_bin); % number of boundaries
% First boundary
boundary1 = boundary{1}; % select boundary 1
x1 = boundary1(:,2); % x coords of boundary1
y1 = boundary1(:,1); % y coords of boundary1
hold on
plot(x1, y1, 'r', 'Linewidth', 2)
% Second boundary
boundary2=boundary{2}
x2 = boundary2(:,2); % x coords of boundary2
y2 = boundary2(:,1); % x coords of boundary2
hold on
plot(x2, y2, 'b', 'Linewidth', 2)
% ...
You could also make a for loop which plots all boundaries, but in your case maybe is better trying to plot one at a time and see which ones are the ones you want, it's up to you.
In order to compute all of the boundaries in a loop you can see the examples in https://es.mathworks.com/help/images/ref/bwboundaries.html
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!