public final class PDF417ScanningDecoder
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static int |
CODEWORD_SKEW_SIZE |
private static ErrorCorrection |
errorCorrection |
private static int |
MAX_EC_CODEWORDS |
private static int |
MAX_ERRORS |
Modifier | Constructor and Description |
---|---|
private |
PDF417ScanningDecoder() |
Modifier and Type | Method and Description |
---|---|
private static BoundingBox |
adjustBoundingBox(DetectionResultRowIndicatorColumn rowIndicatorColumn) |
private static void |
adjustCodewordCount(DetectionResult detectionResult,
BarcodeValue[][] barcodeMatrix) |
private static int |
adjustCodewordStartColumn(BitMatrix image,
int minColumn,
int maxColumn,
boolean leftToRight,
int codewordStartColumn,
int imageRow) |
private static boolean |
checkCodewordSkew(int codewordSize,
int minCodewordWidth,
int maxCodewordWidth) |
private static int |
correctErrors(int[] codewords,
int[] erasures,
int numECCodewords)
Given data and error-correction codewords received, possibly corrupted by errors, attempts to
correct the errors in-place.
|
private static BarcodeValue[][] |
createBarcodeMatrix(DetectionResult detectionResult) |
private static DecoderResult |
createDecoderResult(DetectionResult detectionResult) |
private static DecoderResult |
createDecoderResultFromAmbiguousValues(int ecLevel,
int[] codewords,
int[] erasureArray,
int[] ambiguousIndexes,
int[][] ambiguousIndexValues)
This method deals with the fact, that the decoding process doesn't always yield a single most likely value.
|
static DecoderResult |
decode(BitMatrix image,
ResultPoint imageTopLeft,
ResultPoint imageBottomLeft,
ResultPoint imageTopRight,
ResultPoint imageBottomRight,
int minCodewordWidth,
int maxCodewordWidth) |
private static DecoderResult |
decodeCodewords(int[] codewords,
int ecLevel,
int[] erasures) |
private static Codeword |
detectCodeword(BitMatrix image,
int minColumn,
int maxColumn,
boolean leftToRight,
int startColumn,
int imageRow,
int minCodewordWidth,
int maxCodewordWidth) |
private static BarcodeMetadata |
getBarcodeMetadata(DetectionResultRowIndicatorColumn leftRowIndicatorColumn,
DetectionResultRowIndicatorColumn rightRowIndicatorColumn) |
private static int[] |
getBitCountForCodeword(int codeword) |
private static int |
getCodewordBucketNumber(int codeword) |
private static int |
getCodewordBucketNumber(int[] moduleBitCount) |
private static int |
getMax(int[] values) |
private static int[] |
getModuleBitCount(BitMatrix image,
int minColumn,
int maxColumn,
boolean leftToRight,
int startColumn,
int imageRow) |
private static int |
getNumberOfECCodeWords(int barcodeECLevel) |
private static DetectionResultRowIndicatorColumn |
getRowIndicatorColumn(BitMatrix image,
BoundingBox boundingBox,
ResultPoint startPoint,
boolean leftToRight,
int minCodewordWidth,
int maxCodewordWidth) |
private static int |
getStartColumn(DetectionResult detectionResult,
int barcodeColumn,
int imageRow,
boolean leftToRight) |
private static boolean |
isValidBarcodeColumn(DetectionResult detectionResult,
int barcodeColumn) |
private static DetectionResult |
merge(DetectionResultRowIndicatorColumn leftRowIndicatorColumn,
DetectionResultRowIndicatorColumn rightRowIndicatorColumn) |
static java.lang.String |
toString(BarcodeValue[][] barcodeMatrix) |
private static void |
verifyCodewordCount(int[] codewords,
int numECCodewords)
Verify that all is OK with the codeword array.
|
private static final int CODEWORD_SKEW_SIZE
private static final int MAX_ERRORS
private static final int MAX_EC_CODEWORDS
private static final ErrorCorrection errorCorrection
public static DecoderResult decode(BitMatrix image, ResultPoint imageTopLeft, ResultPoint imageBottomLeft, ResultPoint imageTopRight, ResultPoint imageBottomRight, int minCodewordWidth, int maxCodewordWidth) throws NotFoundException, FormatException, ChecksumException
private static DetectionResult merge(DetectionResultRowIndicatorColumn leftRowIndicatorColumn, DetectionResultRowIndicatorColumn rightRowIndicatorColumn) throws NotFoundException
NotFoundException
private static BoundingBox adjustBoundingBox(DetectionResultRowIndicatorColumn rowIndicatorColumn) throws NotFoundException
NotFoundException
private static int getMax(int[] values)
private static BarcodeMetadata getBarcodeMetadata(DetectionResultRowIndicatorColumn leftRowIndicatorColumn, DetectionResultRowIndicatorColumn rightRowIndicatorColumn)
private static DetectionResultRowIndicatorColumn getRowIndicatorColumn(BitMatrix image, BoundingBox boundingBox, ResultPoint startPoint, boolean leftToRight, int minCodewordWidth, int maxCodewordWidth)
private static void adjustCodewordCount(DetectionResult detectionResult, BarcodeValue[][] barcodeMatrix) throws NotFoundException
NotFoundException
private static DecoderResult createDecoderResult(DetectionResult detectionResult) throws FormatException, ChecksumException, NotFoundException
private static DecoderResult createDecoderResultFromAmbiguousValues(int ecLevel, int[] codewords, int[] erasureArray, int[] ambiguousIndexes, int[][] ambiguousIndexValues) throws FormatException, ChecksumException
erasureArray
- contains the indexes of erasuresambiguousIndexes
- array with the indexes that have more than one most likely valueambiguousIndexValues
- two dimensional array that contains the ambiguous values. The first dimension must
be the same length as the ambiguousIndexes arrayFormatException
ChecksumException
private static BarcodeValue[][] createBarcodeMatrix(DetectionResult detectionResult)
private static boolean isValidBarcodeColumn(DetectionResult detectionResult, int barcodeColumn)
private static int getStartColumn(DetectionResult detectionResult, int barcodeColumn, int imageRow, boolean leftToRight)
private static Codeword detectCodeword(BitMatrix image, int minColumn, int maxColumn, boolean leftToRight, int startColumn, int imageRow, int minCodewordWidth, int maxCodewordWidth)
private static int[] getModuleBitCount(BitMatrix image, int minColumn, int maxColumn, boolean leftToRight, int startColumn, int imageRow)
private static int getNumberOfECCodeWords(int barcodeECLevel)
private static int adjustCodewordStartColumn(BitMatrix image, int minColumn, int maxColumn, boolean leftToRight, int codewordStartColumn, int imageRow)
private static boolean checkCodewordSkew(int codewordSize, int minCodewordWidth, int maxCodewordWidth)
private static DecoderResult decodeCodewords(int[] codewords, int ecLevel, int[] erasures) throws FormatException, ChecksumException
FormatException
ChecksumException
private static int correctErrors(int[] codewords, int[] erasures, int numECCodewords) throws ChecksumException
Given data and error-correction codewords received, possibly corrupted by errors, attempts to correct the errors in-place.
codewords
- data and error correction codewordserasures
- positions of any known erasuresnumECCodewords
- number of error correction codewords that are available in codewordsChecksumException
- if error correction failsprivate static void verifyCodewordCount(int[] codewords, int numECCodewords) throws FormatException
FormatException
private static int[] getBitCountForCodeword(int codeword)
private static int getCodewordBucketNumber(int codeword)
private static int getCodewordBucketNumber(int[] moduleBitCount)
public static java.lang.String toString(BarcodeValue[][] barcodeMatrix)