Watershed algorithm is used for segmentation in some complex images as if we apply simple thresholding and contour detection then will not be able to give proper results.
Watershed algorithm is based on extracting sure background and foreground and then using markers will make watershed run and detect the exact boundaries. This algorithm generally helps in detecting touching and overlapping objects in image.
For markers, it can be user defined like manually clicking and get the coordinates for markers and also using some defined algorithms such as thresholding or any morphological operations.
Due to the presence of noise, we can’t apply watershed algorithm directly.
Let’s dive into the limitation of contour detection.
Limitation of contour detection for image segmentation
As we can see from the above output, contour detection is not able to do the proper segmentation because of the joint coins. This is where segmentation algorithm like watershed comes into picture.
Watershed algorithm for image segmentation
These are the following steps for image segmentation using watershed algorithm -:
Step 1: Finding the sure background using morphological operation like opening and dilation.
Step 2: Finding the sure foreground using distance transform.
Step 3: Unknown area is the area neither lies in foreground and background and used it as a marker for watershed algorithm.
Finding the unknown area(Neither sure foreground and sure background)
Applying watershed algorithm
In this blog, we have discussed the image segmentation algorithm with the limitation of contour detection.
We have seen how to use watershed algorithm with the processing of image using machine learning development solutions.
- Learn Machine Learning in 3 Months
- Understanding of Machine Learning algorithms using Linear algebra
- How Has The Company Revamped Graph Analytics In Hadoop?
- How to Use Google BigQuery & GCP in making Big Data Better?
- Hadoop Disk Replacement Tutorial – Eureka