Unable to scan a QR as a few pixels go off-white (only in certain devices)

359 views
Skip to first unread message

Mohit Shetty

unread,
Sep 22, 2021, 5:44:52 AM9/22/21
to Android CameraX Discussion Group
I'm currently working on implementing QR scanning in a camera based application. It works fine on most devices except a few selected once.

We suspect that it is because a few pixels go off-white in the corners of the QR. Please try comparing the corner to the rest of the QR to see the (off-white) difference. Although we are not sure if that's the issue. 

(Attached the image to this message as an attachment)

Also, the issue isn't with the cropping and we have confirmed it by logging values.

Please help us resolve this issue as soon as possible. We are ready to use camera2 apis if it can help us resolve the issue across all devices.

Sorry to bother you'll with detailed issue. Thanks a lot in advance.
sample.png

Charcoal Chen

unread,
Sep 22, 2021, 7:12:58 AM9/22/21
to Mohit Shetty, Android CameraX Discussion Group
Hi Mohit,

Could you help to clarify the following questions?
1. Does the app analyze the images received from ImageAnalysis?
2. What is the resolution selected for the use case?
3. What use cases are used for the feature?
4. Could you provide some device names that can reproduce the issue? Please also provide the hardware level information of the problematic cameras if possible.
5. Which barcode scanner engine is used? (If it is open source, we can try to reproduce the issue.)
6. The QR code looks much more complicated than the simpler ones like this. Does it have any minimal size requirement to scan successfully? (This indicates the QR code size inside the captured image but not the selected resolution for the use case.) Is it possibly caused by the scanned barcode image being too small to analyze?

--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion on the web visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/959dcf58-49aa-4c22-96f6-0c88e27a4a6fn%40android.com.

Mohit Shetty

unread,
Sep 22, 2021, 9:20:33 AM9/22/21
to Android CameraX Discussion Group, charco...@google.com, Android CameraX Discussion Group, Mohit Shetty
Here's the repository to our app: https://github.com/GrapheneOS/Auditor
You might need two phones to test the app.
Also, even if shows an error in the result activity (that means it has recognized the QR)

Answers to the above given questions:
1. Yes (https://github.com/GrapheneOS/Auditor/blob/37cfc60c017bfda9b228f47f5e2d57d2761abdc0/app/src/main/java/app/attestation/auditor/QRScannerActivity.kt#L116)

4. Here are a list of those devices (based on what feedback we have received):
    Samsung M02
    Samsung A30, A40, A50, A70
    OnePlus Nord N100
    We have got a feedback related to our app but not sure if the issue is with Xiaomi mi8 or Pixel 5A although a user did face issue while scanning dense QR codes using Pixel 5A.

5. I'm not really sure about what is being used internally as I was working more on the CameraX part, but from what I can understand reading the source code...the com.google.zxing.MultiFormatReader class was used. The app can be directly tested from the source code (https://github.com/GrapheneOS/Auditor) or by testing the latest release (Release 32 · GrapheneOS/Auditor (github.com) apk could be found on the bottom of the page). Two phones might be needed for testing. The phone on which QR is there could be any.

6. Yes the QR code needs to be as dense as it currently is for the app to work.

The app used to work earlier on those devices before porting to CameraX.

Thanks for the quick response. Hope the issue gets resolved soon.

Mohit Shetty

unread,
Sep 22, 2021, 2:49:01 PM9/22/21
to Android CameraX Discussion Group, Mohit Shetty, charco...@google.com, Android CameraX Discussion Group
Hey Charco,

There is an update in the given feedback given by one of our users. The "Samsung A30, A40, A50, A70" devices are able to scan the code now, but take a while to do so (which is not the case with other phones).

Extremely sorry for the inconvenience being caused.
Thanks a lot for your valuable time. 

Regards,
Mohit

Charcoal Chen

unread,
Sep 23, 2021, 3:41:17 AM9/23/21
to Android CameraX Discussion Group, shetty...@gmail.com, Charcoal Chen, Android CameraX Discussion Group
Hi Mohit,

Thanks for the updated information. For the other devices, I only have Pixel 5A. I tried to run the verifying process on it with another Pixel 4XL which is in the verified device list. The verification result is successful. The issue reported by you might not only related to CameraX library but also the barcode scanner part. If you still encounter some problems, we might need your help to provide some specific information about the problem you find in CameraX side. For example, no image is returned by ImageAnalysis, the image returned by ImageAnalysis is broken/stretched or the size of the returned image is not big as expected to cause the failures (actually, the 960x960 resolution which the app sets as target resolution should be not supported on most devices). Those information will be helpful to clarify the issue or maybe we can help to provide some suggestions to work around the problem.

Mohit Shetty

unread,
Sep 23, 2021, 1:28:28 PM9/23/21
to Android CameraX Discussion Group, charco...@google.com, Mohit Shetty, Android CameraX Discussion Group
Hi Charco,

Our app used to work well on those devices before porting to CameraX so it's not related to the barcode scanner library (as mentioned earlier). Could you please let us know how all the other required information could be retrieved?

Thanks a lot in advance. Extremely sorry for the inconvenience. 

Charcoal Chen

unread,
Sep 24, 2021, 12:01:56 PM9/24/21
to Android CameraX Discussion Group, shetty...@gmail.com, Charcoal Chen, Android CameraX Discussion Group
Hi Mohit,

Could you help to check whether the received ImageProxy has any problem or not? The received ImageProxy should be YUV_420_888 format. You can copy the YuvToRgbConverter into your project and convert the image from YUV_420_888 format to RGB format. Then, you will be able to save the bitmap as a file or draw it on an ImageView to see whether the barcode looks good or it obviously has some problem.

If the barcode image looks good, please help to check whether the resolution used by ImageAnalysis is the same as the size when the app is not porting to CameraX yet. If the resolutions are different, could you help to check whether the issue still exist if setting the target resolution to make ImageAnalysis use the resolution as the original one?

If the barcode image looks obviously having some problem, please let us know the device information (name, model, API level). We'll need to find a device to do further investigation.

Thanks.

Mohit Shetty

unread,
Sep 24, 2021, 12:23:51 PM9/24/21
to Android CameraX Discussion Group, charco...@google.com, Mohit Shetty, Android CameraX Discussion Group
Hey Charco,

I did try displaying the image once, but it seemed shattered on certain devices irrespective of whether the scanning worked fine or not.

Charcoal Chen

unread,
Sep 24, 2021, 12:39:52 PM9/24/21
to Mohit Shetty, Android CameraX Discussion Group
That issue might be caused by the converter since you said the issue also existed on the devices where the scanner function can work fine.

Could you please try the YuvToRgbConverter again? Some similar converter issues were ever reported before.  The YuvToRgbConverter was the one we recommended and can work fine. Actually ImageAnalysis can support output RGBA_8888 format data since the 1.1.0-alpha08 release. You may also directly use it to check whether the captured barcode image is good or not.
Reply all
Reply to author
Forward
0 new messages