Skip to content

Order of returned points for cv::RotatedRect::points() is inconsistent #23335

@n0099

Description

@n0099

Descripe the doc issue

The document for cv::RotatedRect::points() says

The order is bottomLeft, topLeft, topRight, bottomRight.

which is introduced in #9343.

But in a .NET wrapper for OpenCV 4.7.0 which using the same code snippet in

void RotatedRect::points(Point2f pt[]) const
to calculate four vertices of a RotatedRect:
https://github.com/shimat/opencvsharp/blob/0498156821f052ff6b2fd1205148f07a1de2781d/src/OpenCvSharp/Modules/core/Struct/RotatedRect.cs#L43-L61

It will return points that not forming the order of bottomLeft, topLeft, topRight, bottomRight when the degrees of rotation angle are within the range of 45~315°: shimat/opencvsharp#1541 (comment)

Fix suggestion

Change the implement to guarantee the order of points returned by cv::RotatedRect::points(),
or update the document to indicate the order is unstable.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions