필터 지우기
필터 지우기

Extracting lines from outer image.

조회 수: 2 (최근 30일)
NURUL AMIRA MHD RIZAL
NURUL AMIRA MHD RIZAL 2018년 5월 3일
댓글: NURUL AMIRA MHD RIZAL 2018년 5월 6일
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
Alfonso
Alfonso 2018년 5월 3일
Do you mean finding the x and y coordinates of the 3 lines which are out of the cyclist?
NURUL AMIRA MHD RIZAL
NURUL AMIRA MHD RIZAL 2018년 5월 3일
Yes yes. Something like that

댓글을 달려면 로그인하십시오.

답변 (1개)

Alfonso
Alfonso 2018년 5월 3일
편집: Alfonso 2018년 5월 3일
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
  댓글 수: 1
NURUL AMIRA MHD RIZAL
NURUL AMIRA MHD RIZAL 2018년 5월 6일
May I know, how do you identified this have 32 boundaries? And some people have been asking me to do hough algorithms to detect the lines from the edges. How can it be? I want something like this so that I can identify the angle at the specific line intersections(at the orange dot)

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by