public abstract class OneDReader extends Object implements Reader
| 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 float |
patternMatchVariance(int[] counters,
int[] pattern,
float 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.
|
public Result decode(BinaryBitmap image) throws NotFoundException, FormatException
Readerdecode in interface Readerimage - image of barcode to decodeNotFoundException - if no potential barcode is foundFormatException - if a potential barcode is found but format is invalidpublic Result decode(BinaryBitmap image, Map<DecodeHintType,?> hints) throws NotFoundException, FormatException
Readerdecode in interface Readerimage - 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 no potential barcode is foundFormatException - if a potential barcode is found but format is invalidpublic void reset()
Readerprotected 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
NotFoundExceptionprotected static float patternMatchVariance(int[] counters,
int[] pattern,
float 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 no potential barcode is foundChecksumException - if a potential barcode is found but does not pass its checksumFormatException - if a potential barcode is found but format is invalidCopyright © 2007–2018. All rights reserved.