Implementation of watershed algorithm in python using Open CV
Image Segmentation is the process of dividing the image into multiple segments. Mainly used to locate objects and their boundaries. Watershed Algorithm is a Region Based Segmentation algorithm. Here the image is treated as a topographical landscape with ridges and valleys. The elevations of landscape are typically defined by grey values of the pixels. This method is susceptible to noise and other irregularities and may give over segmented results.
Download and install the following modules:
- numpy - pip install numpy
- matplotlib - pip install matplotlib
- opencv - pip install cv2
- Run the python file
- Each digits (0-9) have seperate colors, Press any digit and left click on the image as many times as you want
- Repeat 2nd step with different colours for each segments
- The segmented image will be updated each time
- Press C to clear points
- Press ESC to stop the program