Grooper Help - Version 25.0
25.0.0017 2,127
  • Overview
  • Help Status

Binarize

IP Command Grooper.IP

Converts grayscale or color images to black and white (binary) using multiple thresholding methods for optimal document clarity.

Remarks

The Binarize command transforms input images into 8-bit black and white format, a critical preprocessing step for document analysis, OCR, and data extraction in Grooper. By reducing images to two colors, Binarize enhances contrast, removes background noise, and standardizes input for downstream processes.

Binarize differs from the Threshold command in that Binarize outputs an 8-bit black and white image used for image analysis, while Threshold outputs a 1-bit black and white image used for compression and storage.

Supported Pixel Formats

Binarize accepts grayscale and color images as input. The output is always a single-channel, 8-bit black and white image. If the input is already binary, the command may skip processing depending on the selected method.

How the Command Works

Binarize offers several thresholding methods, each suited to different document conditions:

  • Simple: Applies a fixed threshold to all pixels. Best for images with uniform lighting and high contrast.
  • Auto: Uses Otsu’s method to automatically select a global threshold, with options to adjust or constrain the result.
  • Adaptive: Calculates a local threshold for each pixel based on its neighborhood, ideal for documents with uneven lighting or complex backgrounds.
  • Dynamic: Similar to adaptive, but more aggressively preserves dark regions, which is useful for faint handwriting, stamps, or marginalia.

The method is selected via the 'Method' property. Additional properties such as 'Threshold', 'Window Size', 'Delta', 'Sigma', 'Maximum Range', 'Adjustment', and 'Black Grouping' allow fine-tuning for specific document types and image qualities. Not all properties are relevant to every method; property visibility is context-sensitive.

Diagnostics Generated

When diagnostic mode is enabled, Binarize logs threshold values, adjustments, and any automatic corrections made during processing. For dynamic thresholding, diagnostic images such as the black grouping mask may be generated to help visualize the effect of configuration changes. These diagnostics assist in tuning the command for optimal results.

Configuration Guidance

  • For most scanned documents, start with the 'Auto' or 'Adaptive' method.
  • Use 'Simple' for well-lit, high-contrast images.
  • Use 'Dynamic' to preserve faint marks or handwriting.
  • Adjust properties such as 'Threshold', 'Window Size', and 'Black Grouping' as needed, using diagnostic mode to evaluate results.
  • Example: To binarize a document with uneven lighting, set 'Method' to Adaptive, 'Window Size' to 10px, and adjust 'Delta' for noise sensitivity.

Binarize is typically used early in the image processing pipeline, preparing documents for OCR, extraction, and analysis by standardizing their appearance and removing background artifacts.

Properties

NameTypeDescription
General
Command Info

Derived Types

There are 1 implementations of Binarize.

Threshold Converts an image to black and white (binary) using a variety of thresholding methods.

Used By

Notification