1 | initial version |
The question is, if there is negative degree value, in normal mathematical quadrant, it will be located in quadrant 2 and 4 but from the picture it shows that it is in quadrant 1 and 3.
While this comment is not correct or accurate, I understand your problem. In the traditional maths axes, the x-coordinate grows from the origin to the right of the horizontal axis, and the y-coordinate grows from the origin to the top of the vertical axis. In image processing, or at least in OpenCV, the convention is that the origin is located at the top-left corner, with the x-coordinate growing to the right of the horizontal axis and the y-coordinate growing to the bottom of the vertical axis. So, main difference is that y-axis is pointing downwards, so to say.
The atan(a)
is positive when a
is positive, and negative otherwise, so the mentioned change in axes convention leads to the results you're obtaining (which are correct, supposing you're using in both images point 1 to be the one in the left side and point 2 the one in the right side, i.e. you're calculating the minimum angle between the line connecting both points and a virtual horizontal line passing through the point at the bottom).