com.google.zxing.aztec.detector.Detector Java Examples

The following examples show how to use com.google.zxing.aztec.detector.Detector. 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: AztecReader.java    From reacteu-app with MIT License 5 votes vote down vote up
@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;
}
 
Example #2
Source File: AztecReader.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public Result decode(BinaryBitmap binarybitmap, Map map)
{
    AztecDetectorResult aztecdetectorresult = (new Detector(binarybitmap.getBlackMatrix())).detect();
    com.google.zxing.ResultPoint aresultpoint[] = aztecdetectorresult.getPoints();
    if (map != null)
    {
        ResultPointCallback resultpointcallback = (ResultPointCallback)map.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
        if (resultpointcallback != null)
        {
            int i = aresultpoint.length;
            for (int j = 0; j < i; j++)
            {
                resultpointcallback.foundPossibleResultPoint(aresultpoint[j]);
            }

        }
    }
    DecoderResult decoderresult = (new Decoder()).decode(aztecdetectorresult);
    Result result = new Result(decoderresult.getText(), decoderresult.getRawBytes(), aresultpoint, BarcodeFormat.AZTEC);
    java.util.List list = decoderresult.getByteSegments();
    if (list != null)
    {
        result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, list);
    }
    String s = decoderresult.getECLevel();
    if (s != null)
    {
        result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, s);
    }
    return result;
}