當前位置: 首頁>>代碼示例>>Java>>正文


Java NotFoundException類代碼示例

本文整理匯總了Java中com.google.zxing.NotFoundException的典型用法代碼示例。如果您正苦於以下問題:Java NotFoundException類的具體用法?Java NotFoundException怎麽用?Java NotFoundException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


NotFoundException類屬於com.google.zxing包,在下文中一共展示了NotFoundException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setCounters

import com.google.zxing.NotFoundException; //導入依賴的package包/類
private void setCounters(BitArray row) throws NotFoundException {
    this.counterLength = 0;
    int i = row.getNextUnset(0);
    int end = row.getSize();
    if (i >= end) {
        throw NotFoundException.getNotFoundInstance();
    }
    boolean isWhite = true;
    int count = 0;
    while (i < end) {
        if ((row.get(i) ^ isWhite) != 0) {
            count++;
        } else {
            counterAppend(count);
            count = 1;
            isWhite = !isWhite;
        }
        i++;
    }
    counterAppend(count);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:22,代碼來源:CodaBarReader.java

示例2: adjustCodewordCount

import com.google.zxing.NotFoundException; //導入依賴的package包/類
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);
  }
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:17,代碼來源:PDF417ScanningDecoder.java

示例3: decodeDigit

import com.google.zxing.NotFoundException; //導入依賴的package包/類
/**
 * Attempts to decode a single UPC/EAN-encoded digit.
 *
 * @param row row of black/white values to decode
 * @param counters the counts of runs of observed black/white/black/... values
 * @param rowOffset horizontal offset to start decoding from
 * @param patterns the set of patterns to use to decode -- sometimes different encodings
 * for the digits 0-9 are used, and this indicates the encodings for 0 to 9 that should
 * be used
 * @return horizontal offset of first pixel beyond the decoded digit
 * @throws NotFoundException if digit cannot be decoded
 */
static int decodeDigit(BitArray row, int[] counters, int rowOffset, int[][] patterns)
    throws NotFoundException {
  recordPattern(row, rowOffset, counters);
  float bestVariance = MAX_AVG_VARIANCE; // worst variance we'll accept
  int bestMatch = -1;
  int max = patterns.length;
  for (int i = 0; i < max; i++) {
    int[] pattern = patterns[i];
    float variance = patternMatchVariance(counters, pattern, MAX_INDIVIDUAL_VARIANCE);
    if (variance < bestVariance) {
      bestVariance = variance;
      bestMatch = i;
    }
  }
  if (bestMatch >= 0) {
    return bestMatch;
  } else {
    throw NotFoundException.getNotFoundInstance();
  }
}
 
開發者ID:10045125,項目名稱:QrCode,代碼行數:33,代碼來源:UPCEANReader.java

示例4: decodePair

import com.google.zxing.NotFoundException; //導入依賴的package包/類
private Pair decodePair(BitArray row, boolean right, int rowNumber, Map<DecodeHintType,?> hints) {
  try {
    int[] startEnd = findFinderPattern(row, 0, right);
    FinderPattern pattern = parseFoundFinderPattern(row, rowNumber, right, startEnd);

    ResultPointCallback resultPointCallback = hints == null ? null :
      (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);

    if (resultPointCallback != null) {
      float center = (startEnd[0] + startEnd[1]) / 2.0f;
      if (right) {
        // row is actually reversed
        center = row.getSize() - 1 - center;
      }
      resultPointCallback.foundPossibleResultPoint(new ResultPoint(center, rowNumber));
    }

    DataCharacter outside = decodeDataCharacter(row, pattern, true);
    DataCharacter inside = decodeDataCharacter(row, pattern, false);
    return new Pair(1597 * outside.getValue() + inside.getValue(),
                    outside.getChecksumPortion() + 4 * inside.getChecksumPortion(),
                    pattern);
  } catch (NotFoundException ignored) {
    return null;
  }
}
 
開發者ID:10045125,項目名稱:QrCode,代碼行數:27,代碼來源:RSS14Reader.java

示例5: checkRows

import com.google.zxing.NotFoundException; //導入依賴的package包/類
private List<ExpandedPair> checkRows(boolean reverse) {
    if (this.rows.size() > 25) {
        this.rows.clear();
        return null;
    }
    this.pairs.clear();
    if (reverse) {
        Collections.reverse(this.rows);
    }
    List<ExpandedPair> ps = null;
    try {
        ps = checkRows(new ArrayList(), 0);
    } catch (NotFoundException e) {
    }
    if (!reverse) {
        return ps;
    }
    Collections.reverse(this.rows);
    return ps;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:21,代碼來源:RSSExpandedReader.java

示例6: findStartPattern

import com.google.zxing.NotFoundException; //導入依賴的package包/類
private int findStartPattern() throws NotFoundException {
  for (int i = 1; i < counterLength; i += 2) {
    int charOffset = toNarrowWidePattern(i);
    if (charOffset != -1 && arrayContains(STARTEND_ENCODING, ALPHABET[charOffset])) {
      // Look for whitespace before start pattern, >= 50% of width of start pattern
      // We make an exception if the whitespace is the first element.
      int patternSize = 0;
      for (int j = i; j < i + 7; j++) {
        patternSize += counters[j];
      }
      if (i == 1 || counters[i-1] >= patternSize / 2) {
        return i;
      }
    }
  }
  throw NotFoundException.getNotFoundInstance();
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:18,代碼來源:CodaBarReader.java

示例7: decodeRow

import com.google.zxing.NotFoundException; //導入依賴的package包/類
Result decodeRow(int rowNumber, BitArray row, int[] extensionStartRange) throws NotFoundException {

    StringBuilder result = decodeRowStringBuffer;
    result.setLength(0);
    int end = decodeMiddle(row, extensionStartRange, result);

    String resultString = result.toString();
    Map<ResultMetadataType,Object> extensionData = parseExtensionString(resultString);

    Result extensionResult =
        new Result(resultString,
                   null,
                   new ResultPoint[] {
                       new ResultPoint((extensionStartRange[0] + extensionStartRange[1]) / 2.0f, rowNumber),
                       new ResultPoint(end, rowNumber),
                   },
                   BarcodeFormat.UPC_EAN_EXTENSION);
    if (extensionData != null) {
      extensionResult.putAllMetadata(extensionData);
    }
    return extensionResult;
  }
 
開發者ID:simplezhli,項目名稱:Tesseract-OCR-Scanner,代碼行數:23,代碼來源:UPCEANExtension5Support.java

示例8: decodeDigit

import com.google.zxing.NotFoundException; //導入依賴的package包/類
/**
 * Attempts to decode a sequence of ITF black/white lines into single
 * digit.
 *
 * @param counters the counts of runs of observed black/white/black/... values
 * @return The decoded digit
 * @throws NotFoundException if digit cannot be decoded
 */
private static int decodeDigit(int[] counters) throws NotFoundException {
  float bestVariance = MAX_AVG_VARIANCE; // worst variance we'll accept
  int bestMatch = -1;
  int max = PATTERNS.length;
  for (int i = 0; i < max; i++) {
    int[] pattern = PATTERNS[i];
    float variance = patternMatchVariance(counters, pattern, MAX_INDIVIDUAL_VARIANCE);
    if (variance < bestVariance) {
      bestVariance = variance;
      bestMatch = i;
    }
  }
  if (bestMatch >= 0) {
    return bestMatch;
  } else {
    throw NotFoundException.getNotFoundInstance();
  }
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:27,代碼來源:ITFReader.java

示例9: decodeCode

import com.google.zxing.NotFoundException; //導入依賴的package包/類
private static int decodeCode(BitArray row, int[] counters, int rowOffset)
    throws NotFoundException {
  recordPattern(row, rowOffset, counters);
  float bestVariance = MAX_AVG_VARIANCE; // worst variance we'll accept
  int bestMatch = -1;
  for (int d = 0; d < CODE_PATTERNS.length; d++) {
    int[] pattern = CODE_PATTERNS[d];
    float variance = patternMatchVariance(counters, pattern, MAX_INDIVIDUAL_VARIANCE);
    if (variance < bestVariance) {
      bestVariance = variance;
      bestMatch = d;
    }
  }
  // TODO We're overlooking the fact that the STOP pattern has 7 values, not 6.
  if (bestMatch >= 0) {
    return bestMatch;
  } else {
    throw NotFoundException.getNotFoundInstance();
  }
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:21,代碼來源:Code128Reader.java

示例10: recordPatternInReverse

import com.google.zxing.NotFoundException; //導入依賴的package包/類
protected static void recordPatternInReverse(BitArray row, int start, int[] counters)
    throws NotFoundException {
  // This could be more efficient I guess
  int numTransitionsLeft = counters.length;
  boolean last = row.get(start);
  while (start > 0 && numTransitionsLeft >= 0) {
    if (row.get(--start) != last) {
      numTransitionsLeft--;
      last = !last;
    }
  }
  if (numTransitionsLeft >= 0) {
    throw NotFoundException.getNotFoundInstance();
  }
  recordPattern(row, start + 1, counters);
}
 
開發者ID:simplezhli,項目名稱:Tesseract-OCR-Scanner,代碼行數:17,代碼來源:OneDReader.java

示例11: moduleSize

import com.google.zxing.NotFoundException; //導入依賴的package包/類
private static float moduleSize(int[] leftTopBlack, BitMatrix image) throws NotFoundException {
  int height = image.getHeight();
  int width = image.getWidth();
  int x = leftTopBlack[0];
  int y = leftTopBlack[1];
  boolean inBlack = true;
  int transitions = 0;
  while (x < width && y < height) {
    if (inBlack != image.get(x, y)) {
      if (++transitions == 5) {
        break;
      }
      inBlack = !inBlack;
    }
    x++;
    y++;
  }
  if (x == width || y == height) {
    throw NotFoundException.getNotFoundInstance();
  }
  return (x - leftTopBlack[0]) / 7.0f;
}
 
開發者ID:simplezhli,項目名稱:Tesseract-OCR-Scanner,代碼行數:23,代碼來源:QRCodeReader.java

示例12: constructResult

import com.google.zxing.NotFoundException; //導入依賴的package包/類
static Result constructResult(List<ExpandedPair> pairs) throws NotFoundException, FormatException {
  BitArray binary = BitArrayBuilder.buildBitArray(pairs);

  AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(binary);
  String resultingString = decoder.parseInformation();

  ResultPoint[] firstPoints = pairs.get(0).getFinderPattern().getResultPoints();
  ResultPoint[] lastPoints  = pairs.get(pairs.size() - 1).getFinderPattern().getResultPoints();

  return new Result(
        resultingString,
        null,
        new ResultPoint[]{firstPoints[0], firstPoints[1], lastPoints[0], lastPoints[1]},
        BarcodeFormat.RSS_EXPANDED
    );
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:17,代碼來源:RSSExpandedReader.java

示例13: decode

import com.google.zxing.NotFoundException; //導入依賴的package包/類
private static Result[] decode(BinaryBitmap image, Map<DecodeHintType, ?> hints, boolean
        multiple) throws NotFoundException, FormatException, ChecksumException {
    List<Result> results = new ArrayList();
    PDF417DetectorResult detectorResult = Detector.detect(image, hints, multiple);
    for (ResultPoint[] points : detectorResult.getPoints()) {
        DecoderResult decoderResult = PDF417ScanningDecoder.decode(detectorResult.getBits(),
                points[4], points[5], points[6], points[7], getMinCodewordWidth(points),
                getMaxCodewordWidth(points));
        Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(),
                points, BarcodeFormat.PDF_417);
        result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, decoderResult
                .getECLevel());
        PDF417ResultMetadata pdf417ResultMetadata = (PDF417ResultMetadata) decoderResult
                .getOther();
        if (pdf417ResultMetadata != null) {
            result.putMetadata(ResultMetadataType.PDF417_EXTRA_METADATA, pdf417ResultMetadata);
        }
        results.add(result);
    }
    return (Result[]) results.toArray(new Result[results.size()]);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:22,代碼來源:PDF417Reader.java

示例14: detect

import com.google.zxing.NotFoundException; //導入依賴的package包/類
public ResultPoint[] detect() throws NotFoundException {
    int height = this.image.getHeight();
    int width = this.image.getWidth();
    int halfHeight = height / 2;
    int halfWidth = width / 2;
    int deltaY = Math.max(1, height / 256);
    int deltaX = Math.max(1, width / 256);
    int bottom = height;
    int right = width;
    int top = ((int) findCornerFromCenter(halfWidth, 0, 0, right, halfHeight, -deltaY, 0,
            bottom, halfWidth / 2).getY()) - 1;
    int left = ((int) findCornerFromCenter(halfWidth, -deltaX, 0, right, halfHeight, 0, top,
            bottom, halfHeight / 2).getX()) - 1;
    right = ((int) findCornerFromCenter(halfWidth, deltaX, left, right, halfHeight, 0, top,
            bottom, halfHeight / 2).getX()) + 1;
    ResultPoint pointD = findCornerFromCenter(halfWidth, 0, left, right, halfHeight, deltaY,
            top, bottom, halfWidth / 2);
    ResultPoint pointA = findCornerFromCenter(halfWidth, 0, left, right, halfHeight, -deltaY,
            top, ((int) pointD.getY()) + 1, halfWidth / 4);
    return new ResultPoint[]{pointA, pointB, pointC, pointD};
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:22,代碼來源:MonochromeRectangleDetector.java

示例15: findStartGuardPattern

import com.google.zxing.NotFoundException; //導入依賴的package包/類
static int[] findStartGuardPattern(BitArray row) throws NotFoundException {
  boolean foundStart = false;
  int[] startRange = null;
  int nextStart = 0;
  int[] counters = new int[START_END_PATTERN.length];
  while (!foundStart) {
    Arrays.fill(counters, 0, START_END_PATTERN.length, 0);
    startRange = findGuardPattern(row, nextStart, false, START_END_PATTERN, counters);
    int start = startRange[0];
    nextStart = startRange[1];
    // Make sure there is a quiet zone at least as big as the start pattern before the barcode.
    // If this check would run off the left edge of the image, do not accept this barcode,
    // as it is very likely to be a false positive.
    int quietStart = start - (nextStart - start);
    if (quietStart >= 0) {
      foundStart = row.isRange(quietStart, start, false);
    }
  }
  return startRange;
}
 
開發者ID:10045125,項目名稱:QrCode,代碼行數:21,代碼來源:UPCEANReader.java


注:本文中的com.google.zxing.NotFoundException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。