how to extend line of image

1 次查看(过去 30 天)
mohd
mohd 2012-5-24
hello everyone,
i have detect two coordinate of pixel which is (1,1) and (2,5). i already join the two coordinate to make a line. i have done it.. my question is i want to extend the line to the end. how to do this.. here i attach picture illustration for your understanding. help me please how to extend line

回答(2 个)

Walter Roberson
Walter Roberson 2012-5-24
Standard algebra. Solve the equation of a line, y = m*x + b, knowing that m = (y2-y1)/(x2-x1) . Use your initial data to calculate m and b, then use those two to fill in the line.

Stephen
Stephen 2012-5-24
if... x1=1,x2=2 and... y1=1,y2=5
(2,5)-(1,1)=m=(1,4), is your slope
so m1=1,m2=4
try
plot([x1 x2]+1e6*[-m1 m1],[y1 y2]+1e6*[-m2 m2])
brute force wins again

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by