QR code decoding images using zxing android

0 votes

In my android application, I used the RGBLuminanceSource class as follows:

LuminanceSource source = new RGBLuminanceSource(width, height, pixels)BinaryBitmap binaryBitmap = new BinaryBitmap(new HybridBinarizer(source));

The problem I am facing here is that: the image has to be too small to be decoded by the android application(and I had to try many sizes to finally got one where the QR code Image is decoded). Meanwhile the same images were decoded easily using the BufferedImageLuminanceSource in Java application without any need to be resized.

What to do to avoid this resizing Problem?

Jun 19 in Others by polo
• 1,500 points
9 views

1 answer to this question.

0 votes

 get Qr code Info from Bitmap using Zxing library.

 Bitmap generatedQRCode;
    int width = generatedQRCode.getWidth();
    int height = generatedQRCode.getHeight();
    int[] pixels = new int[width * height];
    generatedQRCode.getPixels(pixels, 0, width, 0, 0, width, height);

    RGBLuminanceSource source = new RGBLuminanceSource(width, height, pixels);

    BinaryBitmap binaryBitmap = new BinaryBitmap(new HybridBinarizer(source));

    Reader reader = new MultiFormatReader();
    Result result = null;
    try {
        result = reader.decode(binaryBitmap);
    } catch (NotFoundException e) {
        e.printStackTrace();
    } catch (ChecksumException e) {
        e.printStackTrace();
    } catch (FormatException e) {
        e.printStackTrace();
    }
    String text = result.getText();
    textViewQRCode.setText(" CONTENT: " + text);
answered Jun 20 by nisha
• 2,160 points

Related Questions In Others

0 votes
1 answer

No Network Security Config specified, using platform default - Android Log

 I had the same problem as which ...READ MORE

answered Feb 18 in Others by Aditya
• 7,280 points
610 views
0 votes
0 answers

Using StringSets Amazon DynamoDB Android

I have an android application which uses ...READ MORE

Feb 28 in Others by Edureka
• 13,640 points
22 views
0 votes
0 answers

"unable to locate adb" using Android Studio

While testing my app in a real ...READ MORE

May 1 in Others by Kichu
• 19,040 points
33 views
0 votes
0 answers

Android Studio AVD - Emulator: Process finished with exit code 1

Nothing appears to load when starting my android ...READ MORE

May 19 in Others by Kichu
• 19,040 points
85 views
0 votes
0 answers
0 votes
0 answers
0 votes
1 answer

Android - How can I find location using just PINCODE?

1 You can find a location (latitude, longitude) ...READ MORE

answered Jun 1 in Others by nisha
• 2,160 points
35 views
0 votes
2 answers

Code for download video from Youtube on Java, Android

Check the source code (HTML) of YouTube, ...READ MORE

answered Jun 9 in Others by nisha
• 2,160 points
31 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP