I'm starting in OpenCV in Python. I made a code that can detect your face, eyes and smile. I need to get the rotation based on the position of eyes/points.
Example:
Is there any way of doing this with Python?
I'm starting in OpenCV in Python. I made a code that can detect your face, eyes and smile. I need to get the rotation based on the position of eyes/points.
Example:
Is there any way of doing this with Python?
If you have X and Y of 2 points you can use atan2 function. You can read more about it here: https://en.wikipedia.org/wiki/Atan2
Your code to calculate the angle between the points will go like this:
deltaY = point1_y - point2_y
deltaX = point1_x - point2_x
my_radians = math.atan2(deltaY , deltaX)
If you want to convert radians to degrees
my_degrees = math.degrees(my_radians)
To convert from degrees to radians
my_radians = math.radians(my_degrees)