Binarizer enum
The Binarizer enum determines how the image is processed to convert it into a binary format (black and white)
suitable for barcode detection. Binarization is a crucial preprocessing step that significantly impacts
the scanner's ability to detect and decode barcodes accurately.
For more information about image binarization techniques:
Values
- localAverage → const Binarizer
-
Uses local average (adaptive) binarization, also known as Niblack-based binarization.
This method calculates thresholds for each pixel based on the mean and standard deviation of its neighboring pixels. It's particularly effective for:
- Images with varying lighting conditions
- Documents with shadows or gradients
- Barcodes on curved surfaces
Performance Impact: Moderate to slow, but provides the best results for complex scenarios.
const Binarizer(0) - globalHistogram → const Binarizer
-
Uses global histogram-based binarization (Otsu's method).
This method:
- Analyzes the image's histogram to find an optimal global threshold
- Works well with bimodal images (clear distinction between foreground and background)
- Is more efficient than local methods
Performance Impact: Fast, good balance between speed and accuracy for well-lit barcodes.
const Binarizer(1) - fixedThreshold → const Binarizer
-
Uses a single fixed threshold value for the entire image.
This simple method:
- Applies the same threshold value to all pixels
- Works best with high-contrast images
- Is ideal for controlled lighting conditions
Performance Impact: Very fast, but sensitive to lighting variations.
const Binarizer(2) - boolCast → const Binarizer
-
Uses direct boolean casting of pixel values.
This method:
- Simply converts pixel values to binary based on a midpoint value
- Provides minimal processing overhead
- Best suited for perfect scanning conditions
Performance Impact: Fastest method, but least adaptable to real-world conditions.
const Binarizer(3)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → int
-
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited