Collection<byte[]> byteSegmentList = new ArrayList<>(); byteSegmentList.add(newByteSegment); newResult.putMetadata(ResultMetadataType.BYTE_SEGMENTS, byteSegmentList);
Collection<byte[]> byteSegmentList = new ArrayList<>(); byteSegmentList.add(newByteSegment); newResult.putMetadata(ResultMetadataType.BYTE_SEGMENTS, byteSegmentList);
public Result decode(BinaryBitmap image, Hashtable 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 Hashtable 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)).intValue()) % 360; } result.putMetadata(ResultMetadataType.ORIENTATION, new Integer(orientation)); // Update result points ResultPoint[] points = result.getResultPoints(); 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; } } }
public Result[] decodeMultiple(BinaryBitmap image, Hashtable hints) throws NotFoundException { Vector results = new Vector(); DetectorResult[] detectorResult = new MultiDetector(image.getBlackMatrix()).detectMulti(hints); for (int i = 0; i < detectorResult.length; i++) { try { DecoderResult decoderResult = getDecoder().decode(detectorResult[i].getBits()); ResultPoint[] points = detectorResult[i].getPoints(); Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points, BarcodeFormat.QR_CODE); if (decoderResult.getByteSegments() != null) { result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, decoderResult.getByteSegments()); } if (decoderResult.getECLevel() != null) { result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, decoderResult.getECLevel().toString()); } results.addElement(result); } catch (ReaderException re) { // ignore and continue } } if (results.isEmpty()) { return EMPTY_RESULT_ARRAY; } else { Result[] resultArray = new Result[results.size()]; for (int i = 0; i < results.size(); i++) { resultArray[i] = (Result) results.elementAt(i); } return resultArray; } }
List<byte[]> byteSegments = decoderResult.getByteSegments(); if (byteSegments != null) { result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, byteSegments); result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel); result.putMetadata(ResultMetadataType.STRUCTURED_APPEND_SEQUENCE, decoderResult.getStructuredAppendSequenceNumber()); result.putMetadata(ResultMetadataType.STRUCTURED_APPEND_PARITY, decoderResult.getStructuredAppendParity());
List<byte[]> byteSegments = decoderResult.getByteSegments(); if (byteSegments != null) { result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, byteSegments); result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel); result.putMetadata(ResultMetadataType.STRUCTURED_APPEND_SEQUENCE, decoderResult.getStructuredAppendSequenceNumber()); result.putMetadata(ResultMetadataType.STRUCTURED_APPEND_PARITY, decoderResult.getStructuredAppendParity());
result.putMetadata(ResultMetadataType.ORIENTATION, new Integer(180));
(Integer) metadata.get(ResultMetadataType.ORIENTATION)) % 360; result.putMetadata(ResultMetadataType.ORIENTATION, orientation);
List<byte[]> byteSegments = decoderResult.getByteSegments(); if (byteSegments != null) { result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, byteSegments); result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel); result.putMetadata(ResultMetadataType.STRUCTURED_APPEND_SEQUENCE, decoderResult.getStructuredAppendSequenceNumber()); result.putMetadata(ResultMetadataType.STRUCTURED_APPEND_PARITY, decoderResult.getStructuredAppendParity());
List<byte[]> byteSegments = decoderResult.getByteSegments(); if (byteSegments != null) { result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, byteSegments); result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel); result.putMetadata(ResultMetadataType.STRUCTURED_APPEND_SEQUENCE, decoderResult.getStructuredAppendSequenceNumber()); result.putMetadata(ResultMetadataType.STRUCTURED_APPEND_PARITY, decoderResult.getStructuredAppendParity());
(Integer) metadata.get(ResultMetadataType.ORIENTATION)) % 360; result.putMetadata(ResultMetadataType.ORIENTATION, orientation);
result.putMetadata(ResultMetadataType.ORIENTATION, 180);
result.putMetadata(ResultMetadataType.ORIENTATION, 180);
public Result decode(BinaryBitmap image, Hashtable 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.DATAMATRIX); if (decoderResult.getByteSegments() != null) { result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, decoderResult.getByteSegments()); } if (decoderResult.getECLevel() != null) { result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, decoderResult.getECLevel().toString()); } return result; }
public Result decode(BinaryBitmap image, Hashtable 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(); } Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points, BarcodeFormat.QR_CODE); if (decoderResult.getByteSegments() != null) { result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, decoderResult.getByteSegments()); } if (decoderResult.getECLevel() != null) { result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, decoderResult.getECLevel().toString()); } return result; }
decodeResult.putMetadata(ResultMetadataType.UPC_EAN_EXTENSION, extensionResult.getText()); decodeResult.putAllMetadata(extensionResult.getResultMetadata()); decodeResult.addResultPoints(extensionResult.getResultPoints()); String countryID = eanManSupport.lookupCountryIdentifier(resultString); if (countryID != null) { decodeResult.putMetadata(ResultMetadataType.POSSIBLE_COUNTRY, countryID);
decodeResult.putMetadata(ResultMetadataType.UPC_EAN_EXTENSION, extensionResult.getText()); decodeResult.putAllMetadata(extensionResult.getResultMetadata()); decodeResult.addResultPoints(extensionResult.getResultPoints()); String countryID = eanManSupport.lookupCountryIdentifier(resultString); if (countryID != null) { decodeResult.putMetadata(ResultMetadataType.POSSIBLE_COUNTRY, countryID);
String countryID = eanManSupport.lookupCountryIdentifier(resultString); if (countryID != null) { decodeResult.putMetadata(ResultMetadataType.POSSIBLE_COUNTRY, countryID);