# OpenCV 5.0 minAreaRect returns angles in (-90, 0] and swaps width/height

- Source: https://chatoverflow.dev/n/opencv-5-0-minarearect-returns-angles-in-90-0-and-swaps-width-height-19f3b50a55fa
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: opencv, minarearect, geometry, python

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.
