public abstract class OneDReader extends Object implements Reader
Modifier and Type | Field and Description |
---|---|
protected static int |
INTEGER_MATH_SHIFT |
protected static int |
PATTERN_MATCH_RESULT_SCALE_FACTOR |
Constructor and Description |
---|
OneDReader() |
Modifier and Type | Method and Description |
---|---|
Result |
decode(BinaryBitmap image)
Locates and decodes a barcode in some format within an image.
|
Result |
decode(BinaryBitmap image,
Map<DecodeHintType,?> hints)
Locates and decodes a barcode in some format within an image.
|
abstract Result |
decodeRow(int rowNumber,
BitArray row,
Map<DecodeHintType,?> hints)
Attempts to decode a one-dimensional barcode format given a single row of
an image.
|
protected static int |
patternMatchVariance(int[] counters,
int[] pattern,
int maxIndividualVariance)
Determines how closely a set of observed counts of runs of black/white values matches a given
target pattern.
|
protected static void |
recordPattern(BitArray row,
int start,
int[] counters)
Records the size of successive runs of white and black pixels in a row, starting at a given point.
|
protected static void |
recordPatternInReverse(BitArray row,
int start,
int[] counters) |
void |
reset()
Resets any internal state the implementation has after a decode, to prepare it
for reuse.
|
protected static final int INTEGER_MATH_SHIFT
protected static final int PATTERN_MATCH_RESULT_SCALE_FACTOR
public Result decode(BinaryBitmap image) throws NotFoundException, FormatException
Reader
decode
in interface Reader
image
- image of barcode to decodeNotFoundException
- if the barcode cannot be located or decoded for any reasonFormatException
public Result decode(BinaryBitmap image, Map<DecodeHintType,?> hints) throws NotFoundException, FormatException
Reader
decode
in interface Reader
image
- image of barcode to decodehints
- passed as a Map
from DecodeHintType
to arbitrary data. The
meaning of the data depends upon the hint type. The implementation may or may not do
anything with these hints.NotFoundException
- if the barcode cannot be located or decoded for any reasonFormatException
public void reset()
Reader
protected static void recordPattern(BitArray row, int start, int[] counters) throws NotFoundException
row
- row to count fromstart
- offset into row to start atcounters
- array into which to record countsNotFoundException
- if counters cannot be filled entirely from row before running out
of pixelsprotected static void recordPatternInReverse(BitArray row, int start, int[] counters) throws NotFoundException
NotFoundException
protected static int patternMatchVariance(int[] counters, int[] pattern, int maxIndividualVariance)
counters
- observed counterspattern
- expected patternmaxIndividualVariance
- The most any counter can differ before we give uppublic abstract Result decodeRow(int rowNumber, BitArray row, Map<DecodeHintType,?> hints) throws NotFoundException, ChecksumException, FormatException
Attempts to decode a one-dimensional barcode format given a single row of an image.
rowNumber
- row number from top of the rowrow
- the black/white pixel data of the rowhints
- decode hintsResult
containing encoded string and start/end of barcodeNotFoundException
- if an error occurs or barcode cannot be foundChecksumException
FormatException
Copyright © 2007-2014. All Rights Reserved.