Rotated rectangle (RotatedRect) vertices

asked 2018-02-22 07:48:03 -0600

Primoz gravatar image

Hello to everyone!

I need to do some operations on a rotated rectangle and because of that I need to get the vertices. So I used the inbuilt OpenCV functionality and successfully get them. The problem is that I was unable to find any info about the order of the vertices in the output array.

Let's say that in the initial configuration the rectangle longer edges are horizontal. So let's mark the corners in sake of simplicity. 1. bottom left -> A 2. top left -> B 3. top right -> C 4. bottom right -> D

So if we take the previous rectangle and rotate it to the left for a couple of degrees the vertices result will be in the following order: A,B,C,D, the same is true if the angle is zero. However if we rotate it in the opposite direction the result will be D,A,B,C.

I'm guessing that this is consistent so I can extract all of the sides according to the angle of the rectangle?

edit retag flag offensive close merge delete