Showing posts with label Threshold. Show all posts
Showing posts with label Threshold. Show all posts

Thursday, 9 April 2026

Thresholding in Image Processing

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:

g(x,y)={1,f(x,y)T0,f(x,y)<T

Where:

  • f(x,y) = original pixel value
  • g(x,y) = output pixel value
  • T = 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