Thresholding in image processing is a segmentation technique used to separate objects from the background by comparing each pixel’s intensity to a threshold value.
If a pixel value is above or below that threshold, it is assigned to a class.
For a simple binary threshold:
Where:
- = original pixel value
- = output pixel value
- = threshold
Example:
- grayscale pixel = 180, threshold = 128 → output = white
- grayscale pixel = 70, threshold = 128 → output = black
Common types:
- Global thresholding: one threshold for the whole image
- Adaptive thresholding: threshold changes by local region
- Otsu thresholding: automatically finds an optimal threshold
It is commonly used for:
- object detection
- document binarization
- medical image segmentation
- shape extraction