I am using Jupyter Notebook on a remote server (using ssh). I am using matplotlib and I want to save coordinates to annotate pictures to draw bounding boxes.
I used :
collector = []
def onclick(event):
global i, collector
collector.append((event.xdata, event.ydata))
# Open the annotations file to continue to write
target = open('annotation.txt', 'a')
# Write picture and coordinates
target.write(line)
target.write("\n")
i += 1
event.canvas.figure.clear()
event.canvas.figure.gca().imshow(images[i])
fig = plt.figure(figsize=(5,5))
fig.canvas.mpl_connect('button_press_event', onclick)
plt.imshow(images[0])
plt.show()
However, I don't why but it seems to not work anymore. Does someone know a solution to save click events on Jupyter Notebook ?
Thank you very much in advance.