Image Binarization

Description

This operator is used to convert an input grayscale image into a binary image (i.e., an image containing only black and white pixels). By setting a threshold and method, pixels in the image are classified based on their grayscale values; some pixels become pure white (pixel value 255), and others become pure black (pixel value 0), thereby highlighting the image contours or specific regions.

Overview

Provides multiple methods to convert grayscale images into binary images.

Scenarios

  • Image simplification and preprocessing: As a preprocessing step for subsequent complex algorithms, reducing computational load and excluding unimportant background information.

  • Object segmentation: When there is a distinct grayscale difference between the target object and the background, binarization can quickly separate the target from the background to generate a mask image.

Inputs and Outputs

Inputs

Grayscale image: The single-channel grayscale image to be processed.

Outputs

Mask image: The mask image generated after binarization processing, which is a single-channel binary image.

Parameters

Binarization Threshold

Description

Sets a grayscale threshold used to determine whether each pixel should become black or white.

Available when

Standard Binarization

or

Inverted Binarization

is selected as the binarization method.

Tuning Instructions

  • Increasing this value: causes more pixels whose grayscale values fall below the threshold to be classified as black, resulting in fewer white regions in the output image. Suitable for scenarios where background noise needs to be suppressed or only the brightest regions of the image need to be extracted.

  • Decreasing this value: causes more pixels whose grayscale values exceed the threshold to be classified as white, resulting in more white regions in the output image. Suitable for scenarios where the target itself has low brightness or exhibits low contrast against the background.

Parameter Range

[0, 255], default value: 120

Parameter Range

Values/Range: [0, 255]

Default: 120

Binarization Method

Description

Selects the specific algorithm used to perform binarization.

Tuning Instructions

  • Standard Binarization: The most fundamental method. Pixels whose grayscale value is greater than or equal to the binarization threshold are converted to white (255), while those below the threshold are converted to black (0). Suitable for simple scenes with uniform illumination and high contrast between the target and background.

  • Inverted Binarization: The inverse of Standard Binarization. Pixels whose grayscale value is greater than or equal to the binarization threshold are converted to black (0), while those below the threshold are converted to white (255). Suitable for scenarios where darker targets need to be extracted from a bright background.

  • Otsu’s Adaptive Threshold: An adaptive thresholding method. It automatically analyzes the grayscale histogram of the entire image and computes a threshold that maximizes the inter-class variance between the foreground and background. Suitable for scenes with uneven illumination.

  • Triangle Method: Another adaptive thresholding method. It also computes the threshold automatically, and is suitable for images whose grayscale histogram has a single dominant peak — for example, images with a brighter target on a predominantly dark background.

Parameter Range

Values/Range:

  • Standard Binarization

  • Inverse Binarization

  • Otsu’s Adaptive Threshold

  • Triangle Method

Default: Standard Binarization