Search in sources :

Example 1 with QRCodeMultiReader

use of com.google.zxing.multi.qrcode.QRCodeMultiReader in project collect by opendatakit.

the class QRCodeUtils method decodeFromBitmap.

public static String decodeFromBitmap(Bitmap bitmap) throws DataFormatException, IOException, FormatException, ChecksumException, NotFoundException {
    Map<DecodeHintType, Object> tmpHintsMap = new EnumMap<>(DecodeHintType.class);
    tmpHintsMap.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
    tmpHintsMap.put(DecodeHintType.POSSIBLE_FORMATS, BarcodeFormat.QR_CODE);
    tmpHintsMap.put(DecodeHintType.PURE_BARCODE, Boolean.FALSE);
    Reader reader = new QRCodeMultiReader();
    Result result = reader.decode(getBinaryBitmap(bitmap), tmpHintsMap);
    return CompressionUtils.decompress(result.getText());
}
Also used : QRCodeMultiReader(com.google.zxing.multi.qrcode.QRCodeMultiReader) DecodeHintType(com.google.zxing.DecodeHintType) QRCodeMultiReader(com.google.zxing.multi.qrcode.QRCodeMultiReader) Reader(com.google.zxing.Reader) EnumMap(java.util.EnumMap) Result(com.google.zxing.Result)

Aggregations

DecodeHintType (com.google.zxing.DecodeHintType)1 Reader (com.google.zxing.Reader)1 Result (com.google.zxing.Result)1 QRCodeMultiReader (com.google.zxing.multi.qrcode.QRCodeMultiReader)1 EnumMap (java.util.EnumMap)1