-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Shape drawing: Draw closed path by clicking #4928
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
Comments
Wondering if we may consider a feature request to remove undesirable vertices on double click instead. |
@HTenkanen polyline annotations were not added to the shape-drawing features because they do not correspond to a dragmode (instead it's a series of mouseDown event). Is your web app in Javascript only or are you using Dash? |
@archmoj Well yes that is another useful feature as well, but I think ideal situation e.g. in my case would be that I would be able to draw a shape only by adding four nodes/vertices. This is very commonly used approach in many softwares that support drawing shapes on top of images (e.g. several GIS softwares have this functionality). Take a look for example of this live example that allows you to draw an area by clicking points on the corners (done with MapboxGL): https://hel-pop.firebaseapp.com/ The problem with removing vertices after you have created a shape using free-hand style drawing, is that currently you might end up having tens (or even hundreds) of vertices, and I would want to have as few of them as possible. Hence, removing them one by one would cause a lot of extra work. |
@emmanuelle I am currently exploring my possibilities, and I have been starting to build the annotation tool with Dash. Would like to continue with Plotly/Dash (as I have some experience doing apps with it) but this might unfortunately be a deal breaker as I need to regularly do rectangles/bounding boxes that are not straight (i.e. I would need to be able to rotate them). I would like to keep my tech-stack rather simple (for research purposes) which is why I'd rather stick with Python / Dash. |
If going to the React world (which I would like to avoid) then this tool has available something that I'd need, i.e. drawing Polygons of any shape that adds vertices by clicking: https://github.com/waoai/react-image-annotate |
@emmanuelle I understand that you don't want to start messing around with the "dragmode", but do you know if there would be any alternative approaches to draw polygons on top of images by adding vertices based on clicks? |
Hi, I would also be interested in such a functionality, although much time has passed, has any solution or workaround been found in the meantime? @HTenkanen |
@HTenkanen @ronin2304
Then try this on a dash app, it will simplify all drawn polygons immediately in real-time using shapely simplify function : https://shapely.readthedocs.io/en/stable/manual.html#object.simplify
|
you can play with the tolerance argument in the simplify function, 30.0 works fine for me |
Hi - we are trying to tidy up the stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for several years, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. Thanks for your help - @gvwilson |
Relates to #4775 and #4374
Hi guys!
I have a following situation where I basically would like to draw bounding boxes around objects in images such as following:

Currently, this can be done by using the
'drawclosedpath'
, but as you can see this seems to be working only with "freehand" style that does not produce very good results (at least on my shaky hands 🙂 ). What I would like to do is to have a possibility to draw closed polyline by clicking the image (corners) and finishing the shape for example by double clicking. Is this somehow possible currently? Other good option would be, if it would be possible to rotate the rectangle after it has been drawn. Now the direction of the shape is only allowed to two directions which is very limiting in many cases.Any help or ideas how I could manage to do these things would be very welcomed! 🙂
@emmanuelle @archmoj
The text was updated successfully, but these errors were encountered: