Skip to content

fix minAreaRect and boxPoints docs (#26799)#27139

Merged
asmorkalov merged 3 commits intoopencv:4.xfrom
GianlucaNordio:patch-4
Mar 25, 2025
Merged

fix minAreaRect and boxPoints docs (#26799)#27139
asmorkalov merged 3 commits intoopencv:4.xfrom
GianlucaNordio:patch-4

Conversation

@GianlucaNordio
Copy link
Copy Markdown
Contributor

As requested from issue #26799 the docs regarding minAreaRect and boxPoints are extended specifying the order of the corners for boxPoints and the way the angle is computed for the rotated rect returned by minAreaRect

fix boxPoints docs specifying the order of the returned corners as requested from issue opencv#26799
fix minAreaRect by extending the docs with the specification of the angle as requested from issue opencv#26799
@asmorkalov asmorkalov added the category: documentation Documentation fix or update label Mar 24, 2025
@asmorkalov asmorkalov added this to the 4.12.0 milestone Mar 24, 2025
@asmorkalov asmorkalov self-requested a review March 24, 2025 14:53
@asmorkalov asmorkalov self-assigned this Mar 24, 2025
@asmorkalov
Copy link
Copy Markdown
Contributor

CI warnings:


Run cd /home/ci/opencv
modules/imgproc/include/opencv2/imgproc.hpp:4163: trailing whitespace.
+specified point set. The angle of rotation represents the angle between the line connecting the starting 
modules/imgproc/include/opencv2/imgproc.hpp:4165: trailing whitespace.
+and the horizontal axis. This angle always falls between \f$[-90, 0)\f$ because, if the object 
modules/imgproc/include/opencv2/imgproc.hpp:4166: trailing whitespace.
+rotates more than a rect angle, the next edge is used to measure the angle. The starting and ending points change 
modules/imgproc/include/opencv2/imgproc.hpp:4176: trailing whitespace.
+The function finds the four vertices of a rotated rectangle. The four vertices are returned 
modules/imgproc/include/opencv2/imgproc.hpp:4177: trailing whitespace.
+in clockwise order starting from the point with greatest \f$y\f$. If two points have the 
Error: Process completed with exit code 2.

@asmorkalov asmorkalov merged commit 931af51 into opencv:4.x Mar 25, 2025
25 of 28 checks passed
@fabiomng
Copy link
Copy Markdown

fabiomng commented Apr 1, 2025

@GianlucaNordio @asmorkalov I found this PR because I'm getting unexpected results from cv::minAreaRect: it seems to return a positive angle in (0, 90] now, instead of [-90, 0) as written in the comment?

Using Opencv 4.7 the following code prints 45:

std::vector<cv::Point2f> v{{0.0, 0.0}, {0.0, 1.0}, {1.0, 2.0}, {1.0, 1.0}};
std::cout << cv::minAreaRect(v).angle << '\n';

Can you confirm this behavior?

@asmorkalov
Copy link
Copy Markdown
Contributor

@fabiomng Could you file separate bug about it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: documentation Documentation fix or update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants