I’m pretty new here, so please don’t be mad at me!
I’m doing some data analysis and for this purpose I would like to draw profiles of a lot of images. More in the details, this is what I’m doing:
- load the image
- find the contour of the image
- get a point on the contour
- draw a straight line perpendicular to the contour in that point
- get the profile of the image along that straight line.
Up to here, everything is fine and perfectly working. What I would like to implement next is a simple user interaction.
In the specific: at the moment the straight line along which the profile is calculated, is crossing the whole image, but I would like to give the possibility to the user to limit the range of this line between two points. For this reason, I would like the user to select a starting point and ending point simply clicking on the graph, and I thought this would be the perfect application for the mpl_point_clicker.
I was thinking to use two classes (beginning and end), but I want the user to be able to add only one beginning and one end marker. When a second one is added, the first one is removed.
Another point, I doing this with plt.ion() and I don’t know how to make the code execution to wait for both markers to be selected and eventually ask the user for a confirmation about the selection.
Can you help me with this problem?