THRESHOLDING

Thresholding is an image processing technique that converts a grayscale or color image into a simpler image—typically a binary (black-and-white) image—by comparing each pixel's intensity to a predefined threshold value.

Definition

If a pixel's intensity is greater than or equal to the threshold, it is assigned one value (usually white). Otherwise, it is assigned another value (usually black).

I'(x,y) =
{
    255, if I(x,y) ≥ T
      0, if I(x,y) < T
}
  • I(x,y) = Original pixel intensity
  • T = Threshold value
  • I'(x,y) = Output binary pixel

Types of Thresholding

  1. Global Thresholding
    • Uses a single threshold value for the entire image.
    • Best suited for images with uniform lighting.
  2. Adaptive Thresholding
    • Computes different threshold values for different image regions.
    • Effective for images with uneven illumination.
  3. Otsu's Thresholding
    • Automatically determines the optimal global threshold.
    • Minimizes intra-class variance.
    • Commonly used in document and manga preprocessing.
  4. Multi-level Thresholding
    • Uses multiple threshold values.
    • Separates an image into more than two intensity classes.

Applications

  • Document scanning
  • Optical Character Recognition (OCR)
  • Manga and comic scanlation
  • Medical image analysis
  • Industrial machine vision
  • Object detection
  • Image segmentation
  • Barcode and QR code recognition
  • Fingerprint processing

Example

Suppose the threshold value is 128:

Original Pixel Output
45 Black (0)
100 Black (0)
128 White (255)
180 White (255)
240 White (255)

Related Image Processing Operations

  • Grayscale conversion
  • Histogram equalization
  • Contrast enhancement
  • Denoising
  • Morphological operations
    • Erosion
    • Dilation
    • Opening
    • Closing
  • Edge detection
  • Image segmentation
  • Connected-component labeling
  • Contour detection
  • OCR preprocessing
Summary

Thresholding is one of the most fundamental operations in computer vision because it simplifies an image by separating the foreground (such as text or objects) from the background. This simplification makes subsequent image processing tasks, including OCR, segmentation, and object recognition, faster and more accurate.

Comments