当前位置: 首页>>代码示例>>Java>>正文


Java Result.putMetadata方法代码示例

本文整理汇总了Java中com.google.zxing.Result.putMetadata方法的典型用法代码示例。如果您正苦于以下问题:Java Result.putMetadata方法的具体用法?Java Result.putMetadata怎么用?Java Result.putMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.zxing.Result的用法示例。


在下文中一共展示了Result.putMetadata方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: decode

import com.google.zxing.Result; //导入方法依赖的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 results.toArray(new Result[results.size()]);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:18,代码来源:PDF417Reader.java

示例2: decode

import com.google.zxing.Result; //导入方法依赖的package包/类
@Override
public Result decode(BinaryBitmap image,
                     Map<DecodeHintType,?> hints) throws NotFoundException, FormatException {
  try {
    return doDecode(image, hints);
  } catch (NotFoundException nfe) {
    boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER);
    if (tryHarder && image.isRotateSupported()) {
      BinaryBitmap rotatedImage = image.rotateCounterClockwise();
      Result result = doDecode(rotatedImage, hints);
      // Record that we found it rotated 90 degrees CCW / 270 degrees CW
      Map<ResultMetadataType,?> metadata = result.getResultMetadata();
      int orientation = 270;
      if (metadata != null && metadata.containsKey(ResultMetadataType.ORIENTATION)) {
        // But if we found it reversed in doDecode(), add in that result here:
        orientation = (orientation +
            (Integer) metadata.get(ResultMetadataType.ORIENTATION)) % 360;
      }
      result.putMetadata(ResultMetadataType.ORIENTATION, orientation);
      // Update result points
      ResultPoint[] points = result.getResultPoints();
      if (points != null) {
        int height = rotatedImage.getHeight();
        for (int i = 0; i < points.length; i++) {
          points[i] = new ResultPoint(height - points[i].getY() - 1, points[i].getX());
        }
      }
      return result;
    } else {
      throw nfe;
    }
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:34,代码来源:OneDReader.java

示例3: decode

import com.google.zxing.Result; //导入方法依赖的package包/类
@Override
public Result decode(BinaryBitmap image, Map<DecodeHintType,?> hints)
    throws NotFoundException, ChecksumException, FormatException {
  DecoderResult decoderResult;
  ResultPoint[] points;
  if (hints != null && hints.containsKey(DecodeHintType.PURE_BARCODE)) {
    BitMatrix bits = extractPureBits(image.getBlackMatrix());
    decoderResult = decoder.decode(bits);
    points = NO_POINTS;
  } else {
    DetectorResult detectorResult = new Detector(image.getBlackMatrix()).detect();
    decoderResult = decoder.decode(detectorResult.getBits());
    points = detectorResult.getPoints();
  }
  Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points,
      BarcodeFormat.DATA_MATRIX);
  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:amap-demo,项目名称:weex-3d-map,代码行数:27,代码来源:DataMatrixReader.java

示例4: decode

import com.google.zxing.Result; //导入方法依赖的package包/类
@Override
public Result decode(BinaryBitmap image, Map<DecodeHintType,?> hints)
    throws NotFoundException, ChecksumException, FormatException {
  DecoderResult decoderResult;
  if (hints != null && hints.containsKey(DecodeHintType.PURE_BARCODE)) {
    BitMatrix bits = extractPureBits(image.getBlackMatrix());
    decoderResult = decoder.decode(bits, hints);
  } else {
    throw NotFoundException.getNotFoundInstance();
  }

  ResultPoint[] points = NO_POINTS;
  Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points, BarcodeFormat.MAXICODE);

  String ecLevel = decoderResult.getECLevel();
  if (ecLevel != null) {
    result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);
  }
  return result;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:21,代码来源:MaxiCodeReader.java

示例5: decode

import com.google.zxing.Result; //导入方法依赖的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

示例6: decode

import com.google.zxing.Result; //导入方法依赖的package包/类
public Result decode(BinaryBitmap image, Map<DecodeHintType, ?> hints) throws
        NotFoundException, ChecksumException, FormatException {
    DecoderResult decoderResult;
    ResultPoint[] points;
    if (hints == null || !hints.containsKey(DecodeHintType.PURE_BARCODE)) {
        DetectorResult detectorResult = new Detector(image.getBlackMatrix()).detect();
        decoderResult = this.decoder.decode(detectorResult.getBits());
        points = detectorResult.getPoints();
    } else {
        decoderResult = this.decoder.decode(extractPureBits(image.getBlackMatrix()));
        points = NO_POINTS;
    }
    Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points,
            BarcodeFormat.DATA_MATRIX);
    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,代码行数:25,代码来源:DataMatrixReader.java

示例7: decode

import com.google.zxing.Result; //导入方法依赖的package包/类
@Override
public final Result decode(BinaryBitmap image, Map<DecodeHintType,?> hints)
    throws NotFoundException, ChecksumException, FormatException {
  DecoderResult decoderResult;
  ResultPoint[] points;
  if (hints != null && hints.containsKey(DecodeHintType.PURE_BARCODE)) {
    BitMatrix bits = extractPureBits(image.getBlackMatrix());
    decoderResult = decoder.decode(bits, hints);
    points = NO_POINTS;
  } else {
    DetectorResult detectorResult = new Detector(image.getBlackMatrix()).detect(hints);
    decoderResult = decoder.decode(detectorResult.getBits(), hints);
    points = detectorResult.getPoints();
  }

  // If the code was mirrored: swap the bottom-left and the top-right points.
  if (decoderResult.getOther() instanceof QRCodeDecoderMetaData) {
    ((QRCodeDecoderMetaData) decoderResult.getOther()).applyMirroredCorrection(points);
  }

  Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points, BarcodeFormat.QR_CODE);
  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);
  }
  if (decoderResult.hasStructuredAppend()) {
    result.putMetadata(ResultMetadataType.STRUCTURED_APPEND_SEQUENCE,
                       decoderResult.getStructuredAppendSequenceNumber());
    result.putMetadata(ResultMetadataType.STRUCTURED_APPEND_PARITY,
                       decoderResult.getStructuredAppendParity());
  }
  return result;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:38,代码来源:QRCodeReader.java

示例8: decodeMultiple

import com.google.zxing.Result; //导入方法依赖的package包/类
@Override
public Result[] decodeMultiple(BinaryBitmap image, Map<DecodeHintType,?> hints) throws NotFoundException {
  List<Result> results = new ArrayList<>();
  DetectorResult[] detectorResults = new MultiDetector(image.getBlackMatrix()).detectMulti(hints);
  for (DetectorResult detectorResult : detectorResults) {
    try {
      DecoderResult decoderResult = getDecoder().decode(detectorResult.getBits(), hints);
      ResultPoint[] points = detectorResult.getPoints();
      // If the code was mirrored: swap the bottom-left and the top-right points.
      if (decoderResult.getOther() instanceof QRCodeDecoderMetaData) {
        ((QRCodeDecoderMetaData) decoderResult.getOther()).applyMirroredCorrection(points);
      }
      Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points,
                                 BarcodeFormat.QR_CODE);
      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);
      }
      if (decoderResult.hasStructuredAppend()) {
        result.putMetadata(ResultMetadataType.STRUCTURED_APPEND_SEQUENCE,
                           decoderResult.getStructuredAppendSequenceNumber());
        result.putMetadata(ResultMetadataType.STRUCTURED_APPEND_PARITY,
                           decoderResult.getStructuredAppendParity());
      }
      results.add(result);
    } catch (ReaderException re) {
      // ignore and continue 
    }
  }
  if (results.isEmpty()) {
    return EMPTY_RESULT_ARRAY;
  } else {
    results = processStructuredAppend(results);
    return results.toArray(new Result[results.size()]);
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:41,代码来源:QRCodeMultiReader.java

示例9: decode

import com.google.zxing.Result; //导入方法依赖的package包/类
public final Result decode(BinaryBitmap image, Map<DecodeHintType, ?> hints) throws
        NotFoundException, ChecksumException, FormatException {
    DecoderResult decoderResult;
    ResultPoint[] points;
    if (hints == null || !hints.containsKey(DecodeHintType.PURE_BARCODE)) {
        DetectorResult detectorResult = new Detector(image.getBlackMatrix()).detect(hints);
        decoderResult = this.decoder.decode(detectorResult.getBits(), (Map) hints);
        points = detectorResult.getPoints();
    } else {
        decoderResult = this.decoder.decode(extractPureBits(image.getBlackMatrix()), (Map)
                hints);
        points = NO_POINTS;
    }
    if (decoderResult.getOther() instanceof QRCodeDecoderMetaData) {
        ((QRCodeDecoderMetaData) decoderResult.getOther()).applyMirroredCorrection(points);
    }
    Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points,
            BarcodeFormat.QR_CODE);
    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);
    }
    if (decoderResult.hasStructuredAppend()) {
        result.putMetadata(ResultMetadataType.STRUCTURED_APPEND_SEQUENCE, Integer.valueOf
                (decoderResult.getStructuredAppendSequenceNumber()));
        result.putMetadata(ResultMetadataType.STRUCTURED_APPEND_PARITY, Integer.valueOf
                (decoderResult.getStructuredAppendParity()));
    }
    return result;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:35,代码来源:QRCodeReader.java

示例10: decode

import com.google.zxing.Result; //导入方法依赖的package包/类
public Result decode(BinaryBitmap image, Map<DecodeHintType, ?> hints) throws
        NotFoundException, FormatException {
    Result doDecode;
    try {
        doDecode = doDecode(image, hints);
    } catch (NotFoundException nfe) {
        boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER);
        if (tryHarder && image.isRotateSupported()) {
            BinaryBitmap rotatedImage = image.rotateCounterClockwise();
            doDecode = doDecode(rotatedImage, hints);
            Map<ResultMetadataType, ?> metadata = doDecode.getResultMetadata();
            int orientation = 270;
            if (metadata != null && metadata.containsKey(ResultMetadataType.ORIENTATION)) {
                orientation = (((Integer) metadata.get(ResultMetadataType.ORIENTATION))
                        .intValue() + 270) % 360;
            }
            doDecode.putMetadata(ResultMetadataType.ORIENTATION, Integer.valueOf(orientation));
            ResultPoint[] points = doDecode.getResultPoints();
            if (points != null) {
                int height = rotatedImage.getHeight();
                for (int i = 0; i < points.length; i++) {
                    points[i] = new ResultPoint((((float) height) - points[i].getY()) - 1.0f,
                            points[i].getX());
                }
            }
        } else {
            throw nfe;
        }
    }
    return doDecode;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:32,代码来源:OneDReader.java

示例11: decode

import com.google.zxing.Result; //导入方法依赖的package包/类
public Result decode(BinaryBitmap image, Map<DecodeHintType, ?> hints) throws
        NotFoundException, ChecksumException, FormatException {
    if (hints == null || !hints.containsKey(DecodeHintType.PURE_BARCODE)) {
        throw NotFoundException.getNotFoundInstance();
    }
    DecoderResult decoderResult = this.decoder.decode(extractPureBits(image.getBlackMatrix())
            , hints);
    Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(),
            NO_POINTS, BarcodeFormat.MAXICODE);
    String ecLevel = decoderResult.getECLevel();
    if (ecLevel != null) {
        result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);
    }
    return result;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:16,代码来源:MaxiCodeReader.java

示例12: decodeMultiple

import com.google.zxing.Result; //导入方法依赖的package包/类
public Result[] decodeMultiple(BinaryBitmap image, Map<DecodeHintType, ?> hints) throws
        NotFoundException {
    List<Result> results = new ArrayList();
    for (DetectorResult detectorResult : new MultiDetector(image.getBlackMatrix())
            .detectMulti(hints)) {
        try {
            DecoderResult decoderResult = getDecoder().decode(detectorResult.getBits(), hints);
            ResultPoint[] points = detectorResult.getPoints();
            if (decoderResult.getOther() instanceof QRCodeDecoderMetaData) {
                ((QRCodeDecoderMetaData) decoderResult.getOther()).applyMirroredCorrection
                        (points);
            }
            Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(),
                    points, BarcodeFormat.QR_CODE);
            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);
            }
            if (decoderResult.hasStructuredAppend()) {
                result.putMetadata(ResultMetadataType.STRUCTURED_APPEND_SEQUENCE, Integer
                        .valueOf(decoderResult.getStructuredAppendSequenceNumber()));
                result.putMetadata(ResultMetadataType.STRUCTURED_APPEND_PARITY, Integer
                        .valueOf(decoderResult.getStructuredAppendParity()));
            }
            results.add(result);
        } catch (ReaderException e) {
        }
    }
    if (results.isEmpty()) {
        return EMPTY_RESULT_ARRAY;
    }
    results = processStructuredAppend(results);
    return (Result[]) results.toArray(new Result[results.size()]);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:39,代码来源:QRCodeMultiReader.java

示例13: doDecode

import com.google.zxing.Result; //导入方法依赖的package包/类
private Result doDecode(BinaryBitmap image, Map<DecodeHintType, ?> hints) throws
        NotFoundException {
    int maxLines;
    int width = image.getWidth();
    int height = image.getHeight();
    BitArray row = new BitArray(width);
    int middle = height >> 1;
    boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER);
    int rowStep = Math.max(1, height >> (tryHarder ? 8 : 5));
    if (tryHarder) {
        maxLines = height;
    } else {
        maxLines = 15;
    }
    for (int x = 0; x < maxLines; x++) {
        int rowStepsAboveOrBelow = (x + 1) / 2;
        if (!((x & 1) == 0)) {
            rowStepsAboveOrBelow = -rowStepsAboveOrBelow;
        }
        int rowNumber = middle + (rowStep * rowStepsAboveOrBelow);
        if (rowNumber < 0 || rowNumber >= height) {
            break;
        }
        try {
            row = image.getBlackRow(rowNumber, row);
            int attempt = 0;
            while (attempt < 2) {
                if (attempt == 1) {
                    row.reverse();
                    if (hints != null && hints.containsKey(DecodeHintType
                            .NEED_RESULT_POINT_CALLBACK)) {
                        Map<DecodeHintType, Object> newHints = new EnumMap(DecodeHintType
                                .class);
                        newHints.putAll(hints);
                        newHints.remove(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
                        hints = newHints;
                    }
                }
                try {
                    Result result = decodeRow(rowNumber, row, hints);
                    if (attempt == 1) {
                        result.putMetadata(ResultMetadataType.ORIENTATION, Integer.valueOf
                                (180));
                        ResultPoint[] points = result.getResultPoints();
                        if (points != null) {
                            points[0] = new ResultPoint((((float) width) - points[0].getX())
                                    - 1.0f, points[0].getY());
                            points[1] = new ResultPoint((((float) width) - points[1].getX())
                                    - 1.0f, points[1].getY());
                        }
                    }
                    return result;
                } catch (ReaderException e) {
                    attempt++;
                }
            }
            continue;
        } catch (NotFoundException e2) {
        }
    }
    throw NotFoundException.getNotFoundInstance();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:63,代码来源:OneDReader.java

示例14: decode

import com.google.zxing.Result; //导入方法依赖的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


注:本文中的com.google.zxing.Result.putMetadata方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。