// convert the image to a binary bitmap source
LuminanceSource source = new BufferedImageLuminanceSource(image);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
// decode the barcode
QRCodeReader reader = new QRCodeReader();
try {
@SuppressWarnings("rawtypes")
Hashtable hints = new Hashtable();
Result result = reader.decode(bitmap, hints);
log.info("Decoded image successfully, result was : '" + result.getText() + "'");
return result.getText();
} catch (ReaderException e) {
// the data is improperly formatted