Usage
- open image, wait for initialization
- click on any point as first seed, wait a little bit for computation to end if picture is large
- move mouse and see visualized path in real time
environment setup
python == 3.6/3.4.3
opencv == 3.1/3.4
sudo apt-get install python3-pip python3-tk python3-pil.imagetk
sudo pip3 install numpy
to run gui
python3 gui.py
- allow open any image in system
interfaces & global variables
- cursor_x, cursor_y stores current mouse coordinates.
- point_stack is a list that stores previous clicked points
- canvas_path is the current path drawn on canvas
- canvas_path_stack is a list that stores previous drawn lines (in canvas_id)
- history_paths is a list that stores previous computed min paths (in pixel list)
GUI
Implemented required feature:
- Ctrl + left click : first seed
- left click : following seed
- moving cursor in sissor mode: keep a stack for previous seeds in sequence shared between GUI and algorithm. The top element is the current seed. GUI keep sending current cursor coordinates to algorithm, and algorithm keeps computing the path, send it back to GUI, where GUI visuializes it.
- Enter : finish the current contour
- Ctrl + Enter: close current contour and fish
- Backspace: when scissoring, delete the last seed. otherwise, delete selected contour. Select a contour by moving onto it. Selected contour is thicker, un-selected ones are thinner.
Implemented additional feature:
- Click right mouse button and grad to pan in any zoom level
- Scroll bar
- Different width for live wire and drawn path
- Change cursor to pencil when in live wire mode, change it back to pointer when not.
- Size grid at bottom right corner
- Auto resize canvas when window is resized
- Show mouse coordinates below canvas
- Help menu, Help and About window
Wish list:
- point marker for marking start and intermediate points.
- opacity setting for all lines and markers
- Ctrl + '+' : zoom in
- Ctrl + '-' : zoom out