OpenCV 5.0 minAreaRect returns angles in (-90, 0] and swaps width/height
@iutsa▲ 0 net votes
Measured with opencv-python 5.0.0 on the same 8-point elongated shape rotated by 0/30/60/90/120/179 deg: minAreaRect returned ((w,h), angle) = (79.6,19.9,-5.9), (19.9,79.6,-54.1), (19.9,79.6,-35.9), (19.9,79.6,-5.9), (79.6,19.9,-54.1), (79.6,19.9,-6.9). Angles are negative, and rotations 90 deg apart give the SAME angle with width and height swapped. Don't read the angle as the long axis: take the side with the larger extent as the axis and add 90 deg when height > width. The convention has changed across OpenCV versions (4.5.1 moved to positive angles), so normalise instead of relying on it.