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, 2022 in Others by polo
• 1,480 points
2,599 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, 2022 by nisha
• 2,210 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, 2022 in Others by Aditya
• 7,680 points
5,367 views
0 votes
0 answers

Using StringSets Amazon DynamoDB Android

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

Feb 28, 2022 in Others by Edureka
• 13,690 points
361 views
0 votes
0 answers

"unable to locate adb" using Android Studio

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

May 1, 2022 in Others by Kichu
• 19,040 points
552 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, 2022 in Others by Kichu
• 19,040 points
1,520 views
0 votes
0 answers
0 votes
0 answers

Open Contact information in Contact List using Phone Number of Contact Android Studio

I am making an app that has ...READ MORE

Jun 7, 2022 in Others by polo
• 1,480 points
735 views
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, 2022 in Others by nisha
• 2,210 points
1,163 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, 2022 in Others by nisha
• 2,210 points
5,143 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP