当前位置: 首页>>代码示例>>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;未经允许,请勿转载。