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 getting 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 algorithms 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 algorithms like watershed come 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 Nor for 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 algorithms with the processing of images 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