-
-
Notifications
You must be signed in to change notification settings - Fork 56.3k
Fix fillPoly drawing over boundaries #26187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@mshabunin could you take a look? |
| int imgSize = 50; | ||
| int type = CV_8UC1; | ||
| int shift = 0; | ||
| cv::LineTypes lineType = LINE_8; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about other line types? LINE_AA? Will it work the same as before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LINE_AA is not affected by the changes of this PR so it works the same, but it does not pass the test due to the reasons mentioned in the other comment.
LINE_4 passes this test with any shift.
LINE_8 passes this test only with a zero shift. It fails for non-zero shifts, most likely because the methods to draw the contour in fillPoly and polylines differ for LINE_8 with non-zero shifts.
| if (t0.y != t1.y) | ||
| { | ||
| pt0c.y = t0.y; pt1c.y = t1.y; | ||
| pt0c.x = (int64)(t0.x) << XY_SHIFT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does any test check clipping scenario? Non-zero shift?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not add tests for all scenarios since fillPoly and polylines handle incoming points slightly different and also have differences in drawing the contours for certain parameters. To make the contours match in all scenarios probably both functions would need further adjustments.
This PR should fix the matching contours for line_type < LINE_AA and zero shift since it used to match before the changes of #23076
Fixes the bug described in #26130
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.