Eraser for polygon points
Search before asking
- [x] I have searched the X-AnyLabeling issues and found no similar feature requests.
Description
Remove points of a polygon by either lasso or by erasing them like a paint-type program
Use case
After auto-segmentation it taks a long time to remove points if SAM has included a shadow of similar holding shift down and clicking on each point might require 20 clicks, would be faster if you could hold shift and any point you went over was deleted or if you could draw a box and all the points inside were deleted
Additional
No response
Are you willing to submit a PR?
- [ ] Yes I'd like to help by submitting a PR!
Here's a typical example of output from SAM
Hey there! @NickMortimer,
Thanks for the suggestion! We'll consider adding this feature to improve the point removal workflow.
Thanks having looked at the code, I was wondering if adding a ctr/Shift click and say remove points within a set radius of the highlighted point?
Hi @NickMortimer,
Thanks again for the suggestion and for following up with that specific idea about using Ctrl/Shift + click to remove points within a set radius! That's an interesting approach to tackling the bulk removal of unwanted points.
We definitely see the value in having a quicker way to clean up points, especially after auto-segmentation. Your idea highlights a potential interaction method. Thinking through the implementation, the main practical challenge we see with the "set radius" approach is determining what that radius should be – a fixed value might not work well across different zoom levels or point densities, while making it easily configurable might add complexity.
Perhaps, as you initially mentioned, a Lasso tool or an Eraser tool (like in paint programs, maybe with an adjustable brush/radius size using the scroll wheel, for instance?) could offer a more flexible and intuitive way for users to select and remove clusters of points.
While we agree that improving the point removal workflow is important and your suggestions are valuable, we might not have the immediate bandwidth to implement this enhancement ourselves in the very near future.
Since you mentioned you might be willing to help by submitting a PR (which is fantastic!), we would be very grateful if you, or someone else in the community, felt inspired to work on this feature (whether it's the radius-click, lasso, eraser, or another approach). We'd be happy to review and potentially merge a well-implemented solution.
Thanks again for your thoughtful contributions and for helping us think about how to improve X-AnyLabeling!
Thanks for the thoughful response, looking deeper into the code I think that an extra mode would have to be added, EDIT, DRAW and ERASE mode, this would affect some of the default logic such as toggle_draw_mode, If you think adding an extra mode is the way to go I could look at it further. I think ERASE mode would be more consistent in the long run than putting extra states into the edit function?
Thanks for digging deeper into the code and sharing your thoughts on the implementation!
You've raised a very good point. Adding a dedicated ERASE mode alongside the existing EDIT and DRAW modes does seem like a more robust and cleaner approach architecturally. It would likely keep the logic for each mode more focused and potentially make the overall state management simpler in the long run, rather than adding more complex sub-states to the EDIT function.
We agree that this would likely involve adjustments to some existing logic, like the mode toggling you mentioned, to accommodate the new mode correctly.
So yes, we believe introducing a distinct ERASE mode is likely the right direction. If you're willing to explore this further and potentially put together a PR based on this approach, that would be fantastic and greatly appreciated! We'd be happy to review it.
Thanks again for your proactive thinking and willingness to contribute!