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

The following examples show how to use com.google.zxing.datamatrix.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: DataMatrixReader.java    From ZXing-Orient with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #2
Source File: DataMatrixReader.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #3
Source File: DataMatrixReader.java    From weex with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #4
Source File: DataMatrixReader.java    From barcodescanner-lib-aar with MIT License 6 votes vote down vote up
@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;
}
 
Example #5
Source File: DataMatrixReader.java    From reacteu-app with MIT License 6 votes vote down vote up
@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;
}
 
Example #6
Source File: DataMatrixReader.java    From RipplePower with Apache License 2.0 6 votes vote down vote up
@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;
}