フィルターのクリア

How can i find the intersection point between two lines ?

3 ビュー (過去 30 日間)
sufian ahmed
sufian ahmed 2017 年 8 月 21 日
コメント済み: KSSV 2017 年 8 月 22 日
I have some horizontal images and i draw a vertical line upon them. But There are some angle exists among the horizontal lines and vertical line depends on that horizontal lines. So I applied some intersection algorithm , collected from internet, but the output of intersection not good for all cases of horizontal lines. Since I consider three angles as like uploaded images.Here you see that, some intersection points are up and down. I want to fix it at proper place. I mean i want to develop a intersection code which will give proper output for three cases. I have already tried this given code,It will be great for me if someone explain the code how it works basically, because i just collected it from internet.
x1 = [v(1,1) v(1,2)]; %vertical line X intersection point.
y1 = [v(2,1) v(2,2)];%vertical line Y intersection point.
%line2
x2 = [h(1,1) h(1,2)];%Horizontal line X intersection point.
y2 = [h(2,1) h(2,2)];%Horizontal line Y intersection point.
%fit linear polynomial
p1 = polyfit(x1,y1,1);
p2 = polyfit(x2,y2,1);
%calculate intersection
x_intersect = fzero(@(x) polyval(p1-p2,x),3);
y_intersect = polyval(p1,x_intersect);
P(1)=x_intersect;
P(2)=y_intersect;

回答 (1 件)

KSSV
KSSV 2017 年 8 月 22 日
You may use this very effective file exchange to calculate intersection points.
PS: Don't forget to rate that file exchange in there.
  2 件のコメント
sufian ahmed
sufian ahmed 2017 年 8 月 22 日
I already tried it. but it gave some up and down results
KSSV
KSSV 2017 年 8 月 22 日
In that case..you have not used the function properly....this code is very effective....

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGeometric Transformation and Image Registration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by