com.google.zxing.common
Class HybridBinarizer
java.lang.Object
com.google.zxing.Binarizer
com.google.zxing.common.GlobalHistogramBinarizer
com.google.zxing.common.HybridBinarizer
public final class HybridBinarizer
- extends GlobalHistogramBinarizer
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.
- Since:
- BlackBerry API 7.0.0
HybridBinarizer
public HybridBinarizer(LuminanceSource source)
- Since:
- BlackBerry API 7.0.0
getBlackMatrix
public BitMatrix getBlackMatrix()
throws NotFoundException
- Description copied from class:
Binarizer
- Converts a 2D array of luminance data to 1 bit data. As above, assume this method is expensive
and do not call it repeatedly. This method is intended for decoding 2D barcodes and may or
may not apply sharpening. Therefore, a row from this matrix may not be identical to one
fetched using getBlackRow(), so don't mix and match between them.
- Overrides:
getBlackMatrix
in class GlobalHistogramBinarizer
- Returns:
- The 2D array of bits for the image (true means black).
- Throws:
NotFoundException
- Since:
- BlackBerry API 7.0.0
createBinarizer
public Binarizer createBinarizer(LuminanceSource source)
- Description copied from class:
Binarizer
- Creates a new object with the same type as this Binarizer implementation, but with pristine
state. This is needed because Binarizer implementations may be stateful, e.g. keeping a cache
of 1 bit data. See Effective Java for why we can't use Java's clone() method.
- Overrides:
createBinarizer
in class GlobalHistogramBinarizer
- Parameters:
source
- The LuminanceSource this Binarizer will operate on.
- Returns:
- A new concrete Binarizer implementation object.
- Since:
- BlackBerry API 7.0.0
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal