Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to scan QRCode via zxing client

I am unable to scan a QR Code having dark background(dark pink) with lighter QRcode(light pink) on it. I have integrated the zxing barcode scanner in my application to scan codes.. It works perfect for lighter background and dark QRcodes.

I tried this using the default zxing barcode scanner application. But it could not scan such kind of codes.

Following is the QRCode I am trying to scan, enter image description here

Please suggest some solution.

Thankyou.

like image 746
Gautam Mandsorwale Avatar asked Apr 08 '13 14:04

Gautam Mandsorwale


People also ask

Why is my QR code scanning not working?

If you're holding your phone too close or too far away, it won't scan the code. Try holding your phone about 30 cm (1 foot) away and slowly moving it towards the QR code. Some phone cameras can't focus as well as others close up, so you may have to hold your phone a bit further away.

Can ZXing scan QR code?

On click of button_scan_qr_code , CaptureActivity will start scanning using default camera. Once it scans any QR code, it sends back the result to onActivityResult the MainActivity . ZXing also provides online QR Code Generator. Enter the required fields, generate and scan it to get the results.

How do I enable QR scan in Chrome?

1. 3D Touch the Chrome app icon and choose Scan QR Code. 2. Pull down to reveal the Spotlight search box, search for "QR" and select Scan QR Code from Chrome's listing.


1 Answers

Contrast of QR Code you included should be enough for most cameras. Problem here is that the ZXing library does not support inverted QR Codes. It only supports dark codes on light background.

To add this support, you need to invert the image yourself. You can use some code similar to this one: http://www.androidsnippets.com/how-to-invert-bitmap-color

Of course, you will need to integrate the ZXing by including the library to accomplish this, not just by Intent (I don't know how you're doing it now) so you can modify some code.

You can add the code to invert the bitmap in the method decode(byte[], int, int) of class DecodeHandler.

like image 181
Jorge Cevallos Avatar answered Sep 27 '22 18:09

Jorge Cevallos