Thresholding is a basic image operation. During segmentation, we first seperate pixels into two or more categories. Basically, we can classify pixels into two groups based on a threshold. Pixels that exceed a given intensity will be placed in one group and pixels that do not exceed the given intensity will be placed in another group.
Global Thresholding is a type of thresholding where we use a single threshold to seperate pixels and map them to two colors. For example, we can set the pixel value of pixels which exceed the given intensity to 255 and we can set the pixel value of pixels which do not exceed the given intensity to 0. This will result in finding objects from the background sorrounding them. In the above given example, the objects will have the pixel value of 255 while the background will have a pixel value of 0.
But we have to be careful before applying thresholding. This is because not all images will have a clear threshold based on which the image pixels can be mapped into two categories.
Below is given a simple implementation of Global Thresholding where we group pixel to either 255 or 0 based upon a common threshold.