Thursday, January 21, 2021

Automatic segmentation based on thresholding


Hlo ppl, 


Segmentation is one of the major preprocessing steps in analyzing the information present in the image. There are various methods of segmenting an image. In this post, we are going to understand the automatic thresholding method of segmentation. 

The following is the procedure to obtain the threshold,

1) Initial threshold value is taken as the mean of the given grayscale image (In case of color image convert it to gray)
2) With the obtained threshold, split the intensity values of the image into two groups. 
3) Calculate the new threshold as an average of the mean of two groups of intensity values
4) Find the difference between the old and new threshold. 
5) If the difference is smaller than a chosen value (epsilon) , we can stop the iteration. If not repeat from step 2.

The code snippet for implementing the thresholding process can be seen below:


An example for segmentation using automatic thresholding can be seen below:










Automatic segmentation based on thresholding

Hlo ppl,  Segmentation is one of the major preprocessing steps in analyzing the information present in the image. There are various methods ...