src/main/java/seedu/address/bot/qrcode/QRcodeAnalyser.java
private static String decodeQRcode(File qrCodeimage) throws IOException, QRreadException {
        BufferedImage bufferedImage = ImageIO.read(qrCodeimage);
        LuminanceSource source = new BufferedImageLuminanceSource(bufferedImage);
        BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));

        try {
            Result result = new MultiFormatReader().decode(bitmap);
            return result.getText();
        } catch (NotFoundException e) {
            logger.info("There is no QR code in the image");
            throw new QRreadException();
        }
    }
/**
     * Method to decode the QR code using zxing api.
     */
Method to decode the QR code using zxing api.
Method to decode the QR code using zxing api .
private static String decodeQRcode(File qrCodeimage) throws IOException, QRreadException {
        BufferedImage bufferedImage = ImageIO.read(qrCodeimage);
        LuminanceSource source = new BufferedImageLuminanceSource(bufferedImage);
        BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
        try {
            Result result = new MultiFormatReader().decode(bitmap);
            return result.getText();
        } catch (NotFoundException e) {
            logger.info("There is no QR code in the image");
            throw new QRreadException();
        }
    }
private static String decodeQRcode ( File qrCodeimage ) throws IOException , QRreadException { BufferedImage bufferedImage = ImageIO . read ( qrCodeimage ) ; LuminanceSource source = new BufferedImageLuminanceSource ( bufferedImage ) ; BinaryBitmap bitmap = new BinaryBitmap ( new HybridBinarizer ( source ) ) ; try { Result result = new MultiFormatReader ( ) . decode ( bitmap ) ; return result . getText ( ) ; } catch ( NotFoundException e ) { logger . info ( "There is no QR code in the image" ) ; throw new QRreadException ( ) ; } }
Method to decode the QR code using zxing api.
Method to decode the QR code using zxing api .