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


Java ResultPointCallback.foundPossibleResultPoint方法代碼示例

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


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

示例1: decodePair

import com.google.zxing.ResultPointCallback; //導入方法依賴的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:amap-demo,項目名稱:weex-3d-map,代碼行數:27,代碼來源:RSS14Reader.java

示例2: decodePair

import com.google.zxing.ResultPointCallback; //導入方法依賴的package包/類
private Pair decodePair(BitArray row, boolean right, int rowNumber, Map<DecodeHintType,?> hints) {
  try {
    int[] startEnd = findFinderPattern(row, 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:simplezhli,項目名稱:Tesseract-OCR-Scanner,代碼行數:27,代碼來源:RSS14Reader.java

示例3: decodePair

import com.google.zxing.ResultPointCallback; //導入方法依賴的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 re) {
    return null;
  }
}
 
開發者ID:atomsheep,項目名稱:sres-app,代碼行數:27,代碼來源:RSS14Reader.java

示例4: decode

import com.google.zxing.ResultPointCallback; //導入方法依賴的package包/類
@Override
public Result decode(BinaryBitmap image, Map<DecodeHintType,?> hints)
    throws NotFoundException, FormatException {

  AztecDetectorResult detectorResult = new Detector(image.getBlackMatrix()).detect();
  ResultPoint[] points = detectorResult.getPoints();

  if (hints != null) {
    ResultPointCallback rpcb = (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
    if (rpcb != null) {
      for (ResultPoint point : points) {
        rpcb.foundPossibleResultPoint(point);
      }
    }
  }

  DecoderResult decoderResult = new Decoder().decode(detectorResult);

  Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points, BarcodeFormat.AZTEC);
  
  List<byte[]> byteSegments = decoderResult.getByteSegments();
  if (byteSegments != null) {
    result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, byteSegments);
  }
  String ecLevel = decoderResult.getECLevel();
  if (ecLevel != null) {
    result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);
  }
  
  return result;
}
 
開發者ID:atomsheep,項目名稱:sres-app,代碼行數:32,代碼來源:AztecReader.java

示例5: decode

import com.google.zxing.ResultPointCallback; //導入方法依賴的package包/類
public Result decode(BinaryBitmap image, Map<DecodeHintType, ?> hints) throws
        NotFoundException, FormatException {
    ReaderException e;
    NotFoundException notFoundException = null;
    FormatException formatException = null;
    Detector detector = new Detector(image.getBlackMatrix());
    ResultPoint[] points = null;
    DecoderResult decoderResult = null;
    try {
        AztecDetectorResult detectorResult = detector.detect(false);
        points = detectorResult.getPoints();
        decoderResult = new Decoder().decode(detectorResult);
    } catch (NotFoundException e2) {
        notFoundException = e2;
    } catch (FormatException e3) {
        formatException = e3;
    }
    if (decoderResult == null) {
        try {
            detectorResult = detector.detect(true);
            points = detectorResult.getPoints();
            decoderResult = new Decoder().decode(detectorResult);
        } catch (ReaderException e4) {
            e = e4;
            if (notFoundException != null) {
                throw notFoundException;
            } else if (formatException == null) {
                throw formatException;
            } else {
                throw e;
            }
        } catch (ReaderException e42) {
            e = e42;
            if (notFoundException != null) {
                throw notFoundException;
            } else if (formatException == null) {
                throw e;
            } else {
                throw formatException;
            }
        }
    }
    if (hints != null) {
        ResultPointCallback rpcb = (ResultPointCallback) hints.get(DecodeHintType
                .NEED_RESULT_POINT_CALLBACK);
        if (rpcb != null) {
            for (ResultPoint point : points) {
                rpcb.foundPossibleResultPoint(point);
            }
        }
    }
    Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points,
            BarcodeFormat.AZTEC);
    List<byte[]> byteSegments = decoderResult.getByteSegments();
    if (byteSegments != null) {
        result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, byteSegments);
    }
    String ecLevel = decoderResult.getECLevel();
    if (ecLevel != null) {
        result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);
    }
    return result;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:64,代碼來源:AztecReader.java

示例6: decodeRow

import com.google.zxing.ResultPointCallback; //導入方法依賴的package包/類
/**
 * <p>Like {@link #decodeRow(int, BitArray, java.util.Map)}, but
 * allows caller to inform method about where the UPC/EAN start pattern is
 * found. This allows this to be computed once and reused across many implementations.</p>
 */
public Result decodeRow(int rowNumber,
                        BitArray row,
                        int[] startGuardRange,
                        Map<DecodeHintType,?> hints)
    throws NotFoundException, ChecksumException, FormatException {

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

  if (resultPointCallback != null) {
    resultPointCallback.foundPossibleResultPoint(new ResultPoint(
        (startGuardRange[0] + startGuardRange[1]) / 2.0f, rowNumber
    ));
  }

  StringBuilder result = decodeRowStringBuffer;
  result.setLength(0);
  int endStart = decodeMiddle(row, startGuardRange, result);

  if (resultPointCallback != null) {
    resultPointCallback.foundPossibleResultPoint(new ResultPoint(
        endStart, rowNumber
    ));
  }

  int[] endRange = decodeEnd(row, endStart);

  if (resultPointCallback != null) {
    resultPointCallback.foundPossibleResultPoint(new ResultPoint(
        (endRange[0] + endRange[1]) / 2.0f, rowNumber
    ));
  }


  // Make sure there is a quiet zone at least as big as the end pattern after the barcode. The
  // spec might want more whitespace, but in practice this is the maximum we can count on.
  int end = endRange[1];
  int quietEnd = end + (end - endRange[0]);
  if (quietEnd >= row.getSize() || !row.isRange(end, quietEnd, false)) {
    throw NotFoundException.getNotFoundInstance();
  }

  String resultString = result.toString();
  if (!checkChecksum(resultString)) {
    throw ChecksumException.getChecksumInstance();
  }

  float left = (float) (startGuardRange[1] + startGuardRange[0]) / 2.0f;
  float right = (float) (endRange[1] + endRange[0]) / 2.0f;
  BarcodeFormat format = getBarcodeFormat();
  Result decodeResult = new Result(resultString,
      null, // no natural byte representation for these barcodes
      new ResultPoint[]{
          new ResultPoint(left, (float) rowNumber),
          new ResultPoint(right, (float) rowNumber)},
      format);

  try {
    Result extensionResult = extensionReader.decodeRow(rowNumber, row, endRange[1]);
    decodeResult.putMetadata(ResultMetadataType.UPC_EAN_EXTENSION, extensionResult.getText());
    decodeResult.putAllMetadata(extensionResult.getResultMetadata());
    decodeResult.addResultPoints(extensionResult.getResultPoints());
  } catch (ReaderException re) {
    // continue
  }

  if (format == BarcodeFormat.EAN_13 || format == BarcodeFormat.UPC_A) {
    String countryID = eanManSupport.lookupCountryIdentifier(resultString);
    if (countryID != null) {
      decodeResult.putMetadata(ResultMetadataType.POSSIBLE_COUNTRY, countryID);
    }
  }

  return decodeResult;
}
 
開發者ID:atomsheep,項目名稱:sres-app,代碼行數:81,代碼來源:UPCEANReader.java


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