annotations out of canvas are projected to edges incorrectly #334
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.
While I was playing with exported annotations, I noticed that they are not exported correctly when there is a segment with a point outside the boundaries of the canvas.
In coco_utils.py, the following lines do this:
Which simply takes points outside canvas to the edges. However that breaks the geometry:

I don't know if making sure all the segments are in the canvas is needed, so I tested it with
_fitremoved, and exporting & importing kept annotations as-is. I also used pycocoutils and imantics to do use annotations for computer visionry stuff and everything worked as expected, such ascoco.annToMask(), which I had initially suspected might fail with points out of canvas.I tried to implement a version where the points are projected correctly, but quickly realized that there is lots of edge cases, i.e. if you do segmentations around 3 quadrants it will do a shortcut between two edges and miss some of the area. I couldn't think of a solution that doesn't involve a bazillion if statements yet so I left my attempt there in
paperjs_to_coco_cliptobounds()function, in case someone wants to take over where I left it