I am trying to understand the RotatedRect struct and what the angle, height, and width actually represent. Any help appreciated.
I did a minAreaRect and then examined the RotatedRect returned.
First, the angle that is reported is a negative number.
What is the angle relative to/how is it measured?
Is it relative to the origin and the center?
Why am I seeing a negative number?
It seems to me that what is called the “height” and what is called the “width” is variable.
What is the basis for calling something the Height or Width?
Figured this out.
You have to get into the RotatedRect.points to see the vertices of the bounding box.
Assuming an origin at top, left, the point with the highest Y value - (or the rightmost point if two points have the same high Y value) - is designated vertex “0.” The angle from “vertex 0” to the last vertex of the bounding box (“vertex 3”) is what is reported in clockwise fashion. Thus, a negative angle means going counterclockwise (what we would normally think of as a positive angle). Further, because of the way it is set up, the angle will always be between -90 and 0.
This explanation helped me a lot. https://theailearner.com/tag/cv2-minarearect/
When you think about it, all vertices must be rotated by the same angle - just like the whole rotated rectangle…
I am not following you. The angle that is reported is the angle made by the highest Y value (which given an origin of top, left is actually the lowest part of the image) and the right most point (RP) viewed locally. Thus, assuming that the point lay on the Y axis and forms a right triangle, the angle reported is formed by (RP.x, RP.y), (0, Y), and (RP.x, Y), where RP.y is less than Y.