-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Intelligent scissors #336
Comments
@mattmagic149 Hi Matt, Your proposal looks like good. It would be fine if you make the functionality like external library which can be attached to CVAT. |
Hey thanks for the quick response. How would you start the development to make it a third party tool? Cheers, |
Hi Matt, I believe first step is to create a JS library which implements necessary algorithms. It will be quite trivial to integrate after that into CVAT. We will help with that for sure. |
Hi nmanovic, yes you are right that the first step should be the algorithmic implementation. |
Matt,
We will help for sure. Don't worry. We will glad to add something like that. UI part is going to be redesigned. Thus just need your algorithm with a clear example how to use it (interface). After that we will advise what is the best way to integrate it. |
Nikita, thanks for your offer. The implementation would look similar to this: def on_mouse_click(event):
# start_point is the last point the user added by click
if start_point is None:
start_point = (int(event.ydata), int(event.xdata))
else:
end_point = (int(event.ydata), int(event.xdata))
# calculate the least costly path given by the shortest path algorithm
# graph ist the cost from pixel to pixel calculated from the image gradient
# path contains all pixel coordinates from start to end
# remove points that lie on a line.
path = shortest_path(graph, start_point, end_point, length_penalty=length_penalty)
# add those points to the polygon
plt.plot(np.array(path)[:,1], np.array(path)[:,0], c='r')
plt.draw()
start_point = end_point
def on_mouse_move(event):
end_point = (int(event.ydata), int(event.xdata))
# same as above
# points are not added to the polygon yet.
# visualize the path from the last point the user added to the mouse pointer
path = shortest_path(graph, start_point, end_point, length_penalty=length_penalty)
global current_path
if current_path is not None:
current_path.pop(0).remove()
# show the path in the player
current_path = plt.plot(np.array(path)[:,1], np.array(path)[:,0], c='r')
plt.draw() In essense I need to calculate a cost graph based on the image gradient. Let me know if you need additional information. Cheers, |
This A good reference pseudo-code is in the Wikipedia page for livewire There are also a couple of JS implementations that could be used for reference in addition to what has already been linked: |
@rsnk96, Hi! We already started development on intelligent scissors algorithm based on paper in issue's description. Please keep in touch on this issue. |
There's a $100 bounty on this issue if anyone is interested. |
Hey,
I am trying to extend the polygon and polyline tool to snap to a contour. This would make the annotation process for objects with a strong gradient more efficient. I am planning to implement a variation of "Intelligent Scissors for Image Composition" by Eric N. Mortensen & William A. Barrett.
For this purpose I'd need access to the click event when adding/editing a point while in creation mode for polygons/polylines, as well as the gradient information of the image.
The later one I could pre-compute or calculate it once the "magnetic mode" is activated.
Does anyone have a hint for me which parts of the engine are crucial to achieve this?
Cheers,
Matt
The text was updated successfully, but these errors were encountered: