public DecoderResult decode(boolean[][] image) throws ChecksumException, FormatException, NotFoundException { return decode(image, null); }
public DecoderResult decode(BitMatrix bits) throws ChecksumException, FormatException { return decode(bits, null); }
public DecoderResult decode(boolean[][] image) throws ChecksumException, FormatException { return decode(image, null); }
public DecoderResult decode(BitMatrix bits) throws ChecksumException, FormatException { return decode(bits, null); }
public DecoderResult decode(boolean[][] image) throws ChecksumException, FormatException { return decode(image, null); }
public DecoderResult decode(BitMatrix bits) throws ChecksumException, FormatException, NotFoundException { return decode(bits, null); }
/** * <p>Convenience method that can decode a QR Code represented as a 2D array of booleans. * "true" is taken to mean a black module.</p> * * @param image booleans representing white/black QR Code modules * @param hints decoding hints that should be used to influence decoding * @return text and bytes encoded within the QR Code * @throws FormatException if the QR Code cannot be decoded * @throws ChecksumException if error correction fails */ public DecoderResult decode(boolean[][] image, Map<DecodeHintType,?> hints) throws ChecksumException, FormatException { return decode(BitMatrix.parse(image), hints); }
/** * <p>Convenience method that can decode a QR Code represented as a 2D array of booleans. * "true" is taken to mean a black module.</p> * * @param image booleans representing white/black QR Code modules * @param hints decoding hints that should be used to influence decoding * @return text and bytes encoded within the QR Code * @throws FormatException if the QR Code cannot be decoded * @throws ChecksumException if error correction fails */ public DecoderResult decode(boolean[][] image, Map<DecodeHintType,?> hints) throws ChecksumException, FormatException { return decode(BitMatrix.parse(image), hints); }
/** * <p>Convenience method that can decode a QR Code represented as a 2D array of booleans. * "true" is taken to mean a black module.</p> * * @param image booleans representing white/black QR Code modules * @return text and bytes encoded within the QR Code * @throws NotFoundException if the QR Code cannot be found * @throws FormatException if the QR Code cannot be decoded * @throws ChecksumException if error correction fails */ public DecoderResult decode(boolean[][] image, Hashtable hints) throws ChecksumException, FormatException, NotFoundException { int dimension = image.length; BitMatrix bits = new BitMatrix(dimension); for (int i = 0; i < dimension; i++) { for (int j = 0; j < dimension; j++) { if (image[i][j]) { bits.set(j, i); } } } return decode(bits, hints); }
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; } }
try { detectorResult = new Detector(newBitMatrix).detect(decodeHints); result = decoder.decode(detectorResult.getBits(), decodeHints); } catch (ChecksumException | FormatException | NotFoundException e) { Debug.logError(e, module); result = decoder.decode(detectorResult.getBits(), decodeHints); if (!result.getText().equals(message)) { return ServiceUtil.returnError(UtilProperties.getMessage("QRCodeUiLabels", "GeneratedTextNotMatchOriginal", new Object[]{result.getText(), message}, locale)); DecoderResult result = decoder.decode(detectorResult.getBits(), decodeHints); if (!result.getText().equals(message)) { return ServiceUtil.returnError(UtilProperties.getMessage("QRCodeUiLabels", "GeneratedTextNotMatchOriginal", new Object[]{result.getText(), message}, locale));
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; }
for (DetectorResult detectorResult : detectorResults) { try { DecoderResult decoderResult = getDecoder().decode(detectorResult.getBits(), hints); ResultPoint[] points = detectorResult.getPoints();
for (DetectorResult detectorResult : detectorResults) { try { DecoderResult decoderResult = getDecoder().decode(detectorResult.getBits(), hints); ResultPoint[] points = detectorResult.getPoints();
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 (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();