Thresholding is the binarization of an image. We convert a grayscale image to a binary image, where the pixels are either 0 or 255.
For thresholding we can calculate the value of T using Otsu's method. Otsu's method assumes there are two peaks in the grayscale histogram of the image. It then tries to find an optimal value to separate these two peaks- the value of threshold T.