Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read Color QR code #693

Open
duttabhishek0 opened this issue Jan 30, 2022 · 8 comments
Open

Read Color QR code #693

duttabhishek0 opened this issue Jan 30, 2022 · 8 comments

Comments

@duttabhishek0
Copy link

Not able to read QR codes that are colored and have a logo in between

Which library version are you using?
v4.3.0

Which phone/tablet are you using, and which Android version does it run?
Tested on Samsung A51 and Samsung Note 20(API 31/Android 11)

Does the same happen on other devices or an emulator?
yes

In the case of an error do you have a stack trace or adb logs?
NA

I want to scan QR codes that are colored and have a logo in between. Unfortunately, nothing happens the scanner just scans unless and until I go back.

@rkistner
Copy link
Member

rkistner commented Jan 31, 2022

  1. Can you post a sample of the barcode that fails to scan?
  2. Does it work in other barcode scanners, such as this one?

In general, QR codes should have a dark foreground on a light background. The color shouldn't matter, as long as the contract is high enough.

If the QR code has a light foreground on dark background, you'll have compatibility issues with many barcode scanners. With this library, you can use the "INVERTED_SCAN" or "MIXED_SCAN" modes - see this:

integrator.addExtra(Intents.Scan.SCAN_TYPE, Intents.Scan.MIXED_SCAN);

If there is a logo in between, there is also a chance that it removes too much info to be able to scan properly.

@duttabhishek0
Copy link
Author

  1. Can you post a sample of the barcode that fails to scan?
    image

  2. Does it work in other barcode scanners, such as this one?
    No

@rkistner
Copy link
Member

In this case the logo is not specifically an issue, but the contrast is simply too low for the current algorithms to work well.

If you have control over how the barcodes are generated, pick a much darker color for the foreground. If you can't, you'll have difficulty with these barcodes.

@duttabhishek0
Copy link
Author

Yes I can change the contrast. I will do the needful. Thanks for help :)

@khavnu
Copy link

khavnu commented Apr 21, 2022

  1. Can you post a sample of the barcode that fails to scan?
    image
  2. Does it work in other barcode scanners, such as this one?
    No

Result is: https:\www.google.com

First, i think need to reduce image contrast, it work but not good as i expected. (for camera scan: you can do this in SourceData.class with YUVLuminaceSource. For image scan you can convert bitmap to black and white bitmap)

After more research and trick, this is my solution:
You can use GlobalHistogramBinarizer instead of HybridBinarizer(ex: in MixedDecoder.java). This might affect to performance
Hope this help!

@henry-leu
Copy link

Hi,

I also have the same issue reading the qr image.
My company has this greenish qr image.
The qr image contains JWT token string.
ZXing is able to read it.
But the parse result is not a JWT string.
It is an arbitrary string.

May I know what the issue is?
Could it be the image size too big?
Color of the image?

Thanks!

@rkistner
Copy link
Member

If it scans and gives a result, the issue is not likely with the color or size of the image.

Check what results you get with other scanners. It's possible that it's an issue with how the barcode was encoded, rather than with the scanning. If you do get different results with other scanners, create a new issue here with a sample of the barcode.

@henry-leu
Copy link

I use the built-in scanner on iPhone.
It gave me a correct JWT token text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants