Fix occuring artifacts in fillPoly#23076
Merged
alalek merged 1 commit intoopencv:3.4from Jan 28, 2023
inayd:22012-bugfixFillPoly
Merged
Fix occuring artifacts in fillPoly#23076alalek merged 1 commit intoopencv:3.4from inayd:22012-bugfixFillPoly
alalek merged 1 commit intoopencv:3.4from
inayd:22012-bugfixFillPoly
Conversation
alalek
reviewed
Jan 2, 2023
Contributor
Author
|
I adjusted the code after the review. Could you take another look? 🙂 |
alalek
approved these changes
Jan 28, 2023
Member
alalek
left a comment
There was a problem hiding this comment.
LGTM 👍 Thank you for contribution!
Merged
Contributor
|
Today I ran across this question: https://stackoverflow.com/questions/78955298/python-opencv-draws-polygons-outside-of-lines Looks like it started to appear between 4.7 and 4.8 which leads me to believe it's related to this patch. Is that expected? |
4 tasks
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Fixes #22012
Fixing the bug described in #22012
The artifacts can occur when corners of a polygon are outside of the image. To be more precise, the outline of the polygon is being drawn using clipped endpoints of an edge, while the borders of the area to be filled are determined using unclipped points of an edge. This can introduce a small offset between the outline and the filled area in polygons which have corner points outside of the image.
The issue is fixed by correcting the edges when lines are clipped.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request