1 | initial version |
You can create a Point2f (2 dimensions float) in the center of each of the smaller sides of your rectangle:
o o x o o ---> x = point_a
o o o o
o o o
o o
x ---> x = point_b
(Above, "x" represents the points). And then:
double rad_angle = atan(point_a/point_b);
It will generate the angle in rads, If you want the angle in degrees
double degrees_angle * 180/CV_PI;
Cheers!
2 | No.2 Revision |
You can create a Point2f (2 dimensions float) in the center of each of the smaller sides of your rectangle:
o o x o o ---> x = point_a
o o o o
o o o
o o
x ---> x = point_b
(Above, "x" represents the points). And then:
double rad_angle = atan(point_a/point_b);
It will generate the angle in rads, If you want the angle in degrees
double degrees_angle = rad_angle * 180/CV_PI;
Cheers!
3 | No.3 Revision |
You can could create a Point2f (2 dimensions float) in the center of each of the smaller sides of your rectangle:
o o x o o ---> x = point_a
o o o o
o o o
o o
x ---> x = point_b
(Above, "x" represents the points). And then:
double rad_angle = atan(point_a/point_b);
It will generate the angle in rads, If you want the angle in degrees
double degrees_angle = rad_angle * 180/CV_PI;
Cheers!
4 | No.4 Revision |
You could create a Point2f (2 dimensions float) in the center of each of the smaller sides of your rectangle:
o o x o o ---> x = point_a
o o o o
o o o
o o
x ---> x = point_b
(Above, "x" represents the points). And then:This way, you will get a line between those points:
o x o
o | o
o | o
o|o
x
To calculate that line angle in radians:
double rad_angle = atan(point_a/point_b);
It will generate the angle in rads, If you want the angle in degreesdegrees:
double degrees_angle = rad_angle * 180/CV_PI;
Cheers!