Avinash Suresh February 2016

matlab image processing- line passing through 2 points extending beyond the x1,y1 coordinate

I have a problem to solve in matlab. I have 2 points A[x1,x2] and B[y1,y2] of my particles in Image. i want to plot a line between the 2 points and extend it beyond the x1,y1 coordinate alone.

i later check where it intersects.This will tell me where the particle originates. is there some simple code for this?

thank you

regards

Avinash

Answers


Arzeik February 2016

You should narrow down your problem a bit, but I'll suggest creating a C point in the same line as A and B, and as far from A as you wish (say, k times the distance between A and B); then plot the line between C and B.

xC=xA+k*(xA-xB);
yC=yA+k*(yA-yB);

As for finding the intersection (if it is with another line), you can solve it on paper quite easily then implement it on Matlab.

Post Status

Asked in February 2016
Viewed 3,401 times
Voted 4
Answered 1 times

Search




Leave an answer