Java Code Examples for com.google.zxing.pdf417.PDF417Common#MAX_CODEWORDS_IN_BARCODE

The following examples show how to use com.google.zxing.pdf417.PDF417Common#MAX_CODEWORDS_IN_BARCODE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PDF417ScanningDecoder.java    From ZXing-Orient with Apache License 2.0 6 votes vote down vote up
private static void adjustCodewordCount(DetectionResult detectionResult, BarcodeValue[][] barcodeMatrix)
    throws NotFoundException {
  int[] numberOfCodewords = barcodeMatrix[0][1].getValue();
  int calculatedNumberOfCodewords = detectionResult.getBarcodeColumnCount() *
      detectionResult.getBarcodeRowCount() -
      getNumberOfECCodeWords(detectionResult.getBarcodeECLevel());
  if (numberOfCodewords.length == 0) {
    if (calculatedNumberOfCodewords < 1 || calculatedNumberOfCodewords > PDF417Common.MAX_CODEWORDS_IN_BARCODE) {
      throw NotFoundException.getNotFoundInstance();
    }
    barcodeMatrix[0][1].setValue(calculatedNumberOfCodewords);
  } else if (numberOfCodewords[0] != calculatedNumberOfCodewords) {
    // The calculated one is more reliable as it is derived from the row indicator columns
    barcodeMatrix[0][1].setValue(calculatedNumberOfCodewords);
  }
}
 
Example 2
Source File: PDF417ScanningDecoder.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 6 votes vote down vote up
private static void adjustCodewordCount(DetectionResult detectionResult, BarcodeValue[][] barcodeMatrix)
    throws NotFoundException {
  int[] numberOfCodewords = barcodeMatrix[0][1].getValue();
  int calculatedNumberOfCodewords = detectionResult.getBarcodeColumnCount() *
      detectionResult.getBarcodeRowCount() -
      getNumberOfECCodeWords(detectionResult.getBarcodeECLevel());
  if (numberOfCodewords.length == 0) {
    if (calculatedNumberOfCodewords < 1 || calculatedNumberOfCodewords > PDF417Common.MAX_CODEWORDS_IN_BARCODE) {
      throw NotFoundException.getNotFoundInstance();
    }
    barcodeMatrix[0][1].setValue(calculatedNumberOfCodewords);
  } else if (numberOfCodewords[0] != calculatedNumberOfCodewords) {
    // The calculated one is more reliable as it is derived from the row indicator columns
    barcodeMatrix[0][1].setValue(calculatedNumberOfCodewords);
  }
}
 
Example 3
Source File: PDF417ScanningDecoder.java    From weex with Apache License 2.0 6 votes vote down vote up
private static void adjustCodewordCount(DetectionResult detectionResult, BarcodeValue[][] barcodeMatrix)
    throws NotFoundException {
  int[] numberOfCodewords = barcodeMatrix[0][1].getValue();
  int calculatedNumberOfCodewords = detectionResult.getBarcodeColumnCount() *
      detectionResult.getBarcodeRowCount() -
      getNumberOfECCodeWords(detectionResult.getBarcodeECLevel());
  if (numberOfCodewords.length == 0) {
    if (calculatedNumberOfCodewords < 1 || calculatedNumberOfCodewords > PDF417Common.MAX_CODEWORDS_IN_BARCODE) {
      throw NotFoundException.getNotFoundInstance();
    }
    barcodeMatrix[0][1].setValue(calculatedNumberOfCodewords);
  } else if (numberOfCodewords[0] != calculatedNumberOfCodewords) {
    // The calculated one is more reliable as it is derived from the row indicator columns
    barcodeMatrix[0][1].setValue(calculatedNumberOfCodewords);
  }
}
 
Example 4
Source File: PDF417ScanningDecoder.java    From barcodescanner-lib-aar with MIT License 6 votes vote down vote up
private static void adjustCodewordCount(DetectionResult detectionResult, BarcodeValue[][] barcodeMatrix)
    throws NotFoundException {
  int[] numberOfCodewords = barcodeMatrix[0][1].getValue();
  int calculatedNumberOfCodewords = detectionResult.getBarcodeColumnCount() *
      detectionResult.getBarcodeRowCount() -
      getNumberOfECCodeWords(detectionResult.getBarcodeECLevel());
  if (numberOfCodewords.length == 0) {
    if (calculatedNumberOfCodewords < 1 || calculatedNumberOfCodewords > PDF417Common.MAX_CODEWORDS_IN_BARCODE) {
      throw NotFoundException.getNotFoundInstance();
    }
    barcodeMatrix[0][1].setValue(calculatedNumberOfCodewords);
  } else if (numberOfCodewords[0] != calculatedNumberOfCodewords) {
    // The calculated one is more reliable as it is derived from the row indicator columns
    barcodeMatrix[0][1].setValue(calculatedNumberOfCodewords);
  }
}
 
Example 5
Source File: DetectionResult.java    From ZXing-Orient with Apache License 2.0 5 votes vote down vote up
DetectionResultColumn[] getDetectionResultColumns() {
  adjustIndicatorColumnRowNumbers(detectionResultColumns[0]);
  adjustIndicatorColumnRowNumbers(detectionResultColumns[barcodeColumnCount + 1]);
  int unadjustedCodewordCount = PDF417Common.MAX_CODEWORDS_IN_BARCODE;
  int previousUnadjustedCount;
  do {
    previousUnadjustedCount = unadjustedCodewordCount;
    unadjustedCodewordCount = adjustRowNumbers();
  } while (unadjustedCodewordCount > 0 && unadjustedCodewordCount < previousUnadjustedCount);
  return detectionResultColumns;
}
 
Example 6
Source File: DetectionResult.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
DetectionResultColumn[] getDetectionResultColumns() {
  adjustIndicatorColumnRowNumbers(detectionResultColumns[0]);
  adjustIndicatorColumnRowNumbers(detectionResultColumns[barcodeColumnCount + 1]);
  int unadjustedCodewordCount = PDF417Common.MAX_CODEWORDS_IN_BARCODE;
  int previousUnadjustedCount;
  do {
    previousUnadjustedCount = unadjustedCodewordCount;
    unadjustedCodewordCount = adjustRowNumbers();
  } while (unadjustedCodewordCount > 0 && unadjustedCodewordCount < previousUnadjustedCount);
  return detectionResultColumns;
}
 
Example 7
Source File: DetectionResult.java    From weex with Apache License 2.0 5 votes vote down vote up
DetectionResultColumn[] getDetectionResultColumns() {
  adjustIndicatorColumnRowNumbers(detectionResultColumns[0]);
  adjustIndicatorColumnRowNumbers(detectionResultColumns[barcodeColumnCount + 1]);
  int unadjustedCodewordCount = PDF417Common.MAX_CODEWORDS_IN_BARCODE;
  int previousUnadjustedCount;
  do {
    previousUnadjustedCount = unadjustedCodewordCount;
    unadjustedCodewordCount = adjustRowNumbers();
  } while (unadjustedCodewordCount > 0 && unadjustedCodewordCount < previousUnadjustedCount);
  return detectionResultColumns;
}
 
Example 8
Source File: DetectionResult.java    From barcodescanner-lib-aar with MIT License 5 votes vote down vote up
DetectionResultColumn[] getDetectionResultColumns() {
  adjustIndicatorColumnRowNumbers(detectionResultColumns[0]);
  adjustIndicatorColumnRowNumbers(detectionResultColumns[barcodeColumnCount + 1]);
  int unadjustedCodewordCount = PDF417Common.MAX_CODEWORDS_IN_BARCODE;
  int previousUnadjustedCount;
  do {
    previousUnadjustedCount = unadjustedCodewordCount;
    unadjustedCodewordCount = adjustRowNumbers();
  } while (unadjustedCodewordCount > 0 && unadjustedCodewordCount < previousUnadjustedCount);
  return detectionResultColumns;
}