Why is +0.5 and dilate with 0.5 a better solution in mask_to_polygons function in detectron2.utils.visualizer? #5033
Unanswered
esmeecerfonteijn
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The mask_to_polygons function that is defined in the detectron2.utils.visualizer source code (see https://detectron2.readthedocs.io/en/latest/_modules/detectron2/utils/visualizer.html) contains a comment that says that first adding +0.5 to the coordinates and then dilating the polygon with a factor 0.5, is a better solution than only adding +0.5 to the coordinates from the OpenCV contour.
Why would that a better solution?
What is the reason for the current implementation instead of the proposed better solution?
Current implementation: res = [x + 0.5 for x in res if len(x) >= 6]
Adding +0.5 to the OpenCV coordinates translates the coordinates to the pixel center, that is at (0.5, 0.5) of each pixel.
Beta Was this translation helpful? Give feedback.
All reactions