HybridBinarizer class
This class implements a local thresholding algorithm, which while slower than the GlobalHistogramBinarizer, is fairly efficient for what it does.
It is designed for high frequency images of barcodes with black data on white backgrounds. For this application, it does a much better job than a global blackpoint with severe shadows and gradients. However it tends to produce artifacts on lower frequency images and is therefore not a good general purpose binarizer for uses outside ZXing.
This class extends GlobalHistogramBinarizer, using the older histogram approach for 1D readers, and the newer local approach for 2D readers. 1D decoding using a per-row histogram is already inherently local, and only fails for horizontal gradients. We can revisit that problem later, but for now it was not a win to use local blocks for 1D.
This Binarizer is the default for the unit tests and the recommended class for library users.
@author dswitkin@google.com (Daniel Switkin)
- Inheritance
-
- Object
- Binarizer
- GlobalHistogramBinarizer
- HybridBinarizer
Constructors
- HybridBinarizer(LuminanceSource source)
Properties
- blackMatrix → BitMatrix
-
Calculates the final BitMatrix once for all requests. This could be called once from the
constructor instead, but there are some advantages to doing it lazily, such as making
profiling easier, and not doing heavy lifting when callers don't expect it.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → int
-
no setterinherited
- luminanceSource → LuminanceSource
-
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- width → int
-
no setterinherited
Methods
-
createBinarizer(
LuminanceSource source) → Binarizer -
Creates a Binarizer with the same type as this Binarizer implementation, but with pristine
state.
override
-
getBlackRow(
int y, BitArray? row) → BitArray -
Converts the row
y
of luminance data torow
(true means black).inherited -
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
Constants
- blockSize → const int
- blockSizeMask → const int
- blockSizePower → const int
- minDynamicRange → const int
- minimumDimension → const int