本文整理汇总了Java中com.google.zxing.common.DecoderResult.getRawBytes方法的典型用法代码示例。如果您正苦于以下问题:Java DecoderResult.getRawBytes方法的具体用法?Java DecoderResult.getRawBytes怎么用?Java DecoderResult.getRawBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.zxing.common.DecoderResult
的用法示例。
在下文中一共展示了DecoderResult.getRawBytes方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decode
import com.google.zxing.common.DecoderResult; //导入方法依赖的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()]);
}
示例2: decode
import com.google.zxing.common.DecoderResult; //导入方法依赖的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;
}
示例3: decode
import com.google.zxing.common.DecoderResult; //导入方法依赖的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;
}
示例4: decode
import com.google.zxing.common.DecoderResult; //导入方法依赖的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()]);
}
示例5: decode
import com.google.zxing.common.DecoderResult; //导入方法依赖的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;
}
示例6: decode
import com.google.zxing.common.DecoderResult; //导入方法依赖的package包/类
@Override
public Result decode(BinaryBitmap image, Map<DecodeHintType,?> hints)
throws NotFoundException, FormatException, ChecksumException {
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).detect();
decoderResult = decoder.decode(detectorResult.getBits());
points = detectorResult.getPoints();
}
return new Result(decoderResult.getText(), decoderResult.getRawBytes(), points,
BarcodeFormat.PDF_417);
}
示例7: decode
import com.google.zxing.common.DecoderResult; //导入方法依赖的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;
}
示例8: decodeMultiple
import com.google.zxing.common.DecoderResult; //导入方法依赖的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()]);
}
}
示例9: decode
import com.google.zxing.common.DecoderResult; //导入方法依赖的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;
}
示例10: decode
import com.google.zxing.common.DecoderResult; //导入方法依赖的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;
}
示例11: decodeMultiple
import com.google.zxing.common.DecoderResult; //导入方法依赖的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()]);
}
示例12: decode
import com.google.zxing.common.DecoderResult; //导入方法依赖的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;
}
示例13: decodeMultiple
import com.google.zxing.common.DecoderResult; //导入方法依赖的package包/类
@Override
public Result[] decodeMultiple(BinaryBitmap image, Map<DecodeHintType,?> hints) throws NotFoundException {
List<Result> results = new ArrayList<Result>();
DetectorResult[] detectorResults = new MultiDetector(image.getBlackMatrix()).detectMulti(hints);
for (DetectorResult detectorResult : detectorResults) {
try {
DecoderResult decoderResult = getDecoder().decode(detectorResult.getBits(), hints);
ResultPoint[] points = detectorResult.getPoints();
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);
}
results.add(result);
} catch (ReaderException re) {
// ignore and continue
}
}
if (results.isEmpty()) {
return EMPTY_RESULT_ARRAY;
} else {
return results.toArray(new Result[results.size()]);
}
}
示例14: decode
import com.google.zxing.common.DecoderResult; //导入方法依赖的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;
}