public abstract class OneDReader extends Objectimplements Reader
| Constructor and Description |
|---|
OneDReader()
|
| Modifier and Type | Method and Description |
|---|---|
Result |
decode(BinaryBitmap
Locates and decodes a barcode in some format within an image.
|
Result |
decode(BinaryBitmap
Locates and decodes a barcode in some format within an image.
|
abstract Result |
decodeRow(int rowNumber, BitArray
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
Records the size of successive runs of white and black pixels in a row, starting at a given point.
|
protected static void |
recordPatternInReverse(BitArray
|
void |
reset()
Resets any internal state the implementation has after a decode, to prepare it for reuse.
|
public Resultdecode(BinaryBitmap image) throws NotFoundException , FormatException
Reader
decode in interface
Reader
image - image of barcode to decode
NotFoundException - if no potential barcode is found
FormatException - if a potential barcode is found but format is invalid
public Resultdecode(BinaryBitmap image, Map <DecodeHintType ,?> hints) throws NotFoundException , FormatException
Reader
decode in interface
Reader
image - image of barcode to decode
hints - 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 found
FormatException - if a potential barcode is found but format is invalid
public void reset()
Reader
protected static void recordPattern(BitArrayrow, int start, int[] counters) throws NotFoundException
row - row to count from
start - offset into row to start at
counters - array into which to record counts
NotFoundException - if counters cannot be filled entirely from row before running out of pixels
protected static void recordPatternInReverse(BitArrayrow, int start, int[] counters) throws NotFoundException
NotFoundException
protected static float patternMatchVariance(int[] counters,
int[] pattern,
float maxIndividualVariance)
counters - observed counters
pattern - expected pattern
maxIndividualVariance - The most any counter can differ before we give up
public abstract ResultdecodeRow(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 row
row - the black/white pixel data of the row
hints - decode hints
Result containing encoded string and start/end of barcode
NotFoundException - if no potential barcode is found
ChecksumException - if a potential barcode is found but does not pass its checksum
FormatException - if a potential barcode is found but format is invalid