필터 지우기
필터 지우기

How to extend line until end of image

조회 수: 7 (최근 30일)
pasta pontikaki
pasta pontikaki 2019년 5월 28일
댓글: pasta pontikaki 2019년 5월 28일
Lets say, i have a line and i want to extend the line until the end of the image.
The line is displayed in the first photo with the green is my basic line, i want to extend it like the second image, until the end of the image.
I want to do this for all the lines that i have detected.
Does anyone knows how to do this?
line2.png
line3.png
  댓글 수: 1
pasta pontikaki
pasta pontikaki 2019년 5월 28일
I think i found it
X= [x1, x2]
Y=[y1, y2]
c = [[1; 1] X(:)]\Y(:);
slope_m = c(2)
intercept_b = c(1)
aLine = [slope_m,-1,intercept_b];
points = lineToBorderPoints(aLine,size(negfillHoles))
line(points([1 ,3]),points([2 ,4]),'LineWidth',1.5,'Color','r');
plot(x1,y1,'*','LineWidth',2,'Color','g');

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

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by