Iteratively draw lines on an image using mouse (movement or clicks) and store them in a dataframe

Viewed 32

I am trying to create a GUI for:

  1. Uploading an image to the window (browsing functionality)
  2. Using iterations, I wish to draw multiple lines on the image selected: I intend to have an interface that has data and input labels that facilitate user inputs such as line name, and some other parameters for each line to be drawn. For example, Name: Line 1, Date: 22/12/2022; then I would draw a line using the mouse (multiple line segments make a line-polyline), then click a button (say "NEXT"), that would save it to a dataframe row and clear the input fields for the next line to be defined and drawn. Similarly, I intend to populate the dataframe with the data for all the lines (Columns such as Name, Date, Coordinates etc).
  3. Using the data in the dataframe, I wish to perform some calculations such as intersection points, length of each line etc.

I am new to GUI projects and have been at it for around 2 weeks. Steps 1 and 3 are relatively easy and are doable. For step 2, I have been looking into opencv, kivy and tkinter libraries and have found some similar questions but I couldn't find anything related to iterating the drawing functionality. Also, I am not able to find resources that combine the user data inputs and the lines to be drawn.

If anyone has any ideas on how to approach this, please comment. Thanks in advance.

Here's the complete code that I have

0 Answers
Related