Getting properties from rotated rectangle OpenCV Python

We need width and height of the rotated rectangle contour in OpenCV Python

What do you need exactly? The lengths of the major/min or axes of the rect? Or the values of the bounding box containg the rotated bounding rect?

If the first one the function you are looking for is here:

From there you should have a set of points. You can simply calculate the length of each edge using itertools and the distance formula , filter out the diagonal lengths. Then Bingo.

(you could also use a simplify contour function without the minimum bounding box function to get a simmilar effect)

when we print minAreaRect its like ((num, num), (num, num), angle) we find angle with minAreaRect[2] and that returns angle from it but we also want the width data for more accurate distance calculation

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.