Here is the simple solution to find a point in an image when angle and starting point is given
Use the trigonometric equations
x2 = x1 + length * cos(θ)
y2 = y1 + length * sin(θ)
Where
θ should be in radians
θ = angle * 3.14 / 180.0
In OpenCV rewrite the equation like
int angle = 60, length = 200;
Point P1(150,150), P2;
P2.x = (int)round(P1.x + length * cos(angle * CV_PI / 180.0));
P2.y = (int)round(P1.y + length * sin(angle * CV_PI / 180.0));
No comments:
Post a Comment