googlesamples / mlkit

A collection of sample apps to demonstrate how to use Google's ML Kit APIs on Android and iOS
Apache License 2.0
3.6k stars 2.94k forks source link

Barcode scanning -> Not being able to scan high density PDF417 on latest mlkit version #374

Closed rjmangubat23 closed 2 years ago

rjmangubat23 commented 3 years ago

I am not able to scan high density PDF417 or a PDF417 containing large Base64 string value.

See sample below: image

The issue happens on latest version com.google.mlkit:barcode-scanning:17.0.0 with Text Recognition v2 com.google.mlkit:text-recognition:16.0.0-beta1 but does not happen in versions like 16.0.2 or older versions with Text Recognition v1 com.google.android.gms:play-services-mlkit-text-recognition:16.1.0.

I also tried using the older version alongside Text Recognition v2 however I am getting a classdef error as shown below: image

Is there a workaround this by any chance?

Thank you in advance! 😄

catluc commented 3 years ago

I have the same problem reading boarding cards with same format PDF417, but I think is related if inside bitmap is already another QRCode

SilverDestiny commented 3 years ago

Hi,

I tried both com.google.mlkit:barcode-scanning:17.0.0 and com.google.mlkit:barcode-scanning:16.2.0 for your image and both cannot detect this barcode. Could you provide a clear image that the barcode could be detected by any barcode version?

And as you mentioned you used text recognition together with barcode scanning, what is text recognition used in your case? Is it related to the barcode scanning function?

The app I used is the ML Kit quickstart app which is also using text recognition together: https://github.com/googlesamples/mlkit/tree/master/android/vision-quickstart

rjmangubat23 commented 3 years ago

Hello @SilverDestiny

can you please try this one?

barcode

I used text recognition on a separate case or function on our app mainly using for MRZ reading not directly related to this. However, I am getting the class def error as shown above when I use the latest version for both. It mostly happens when I scan the PDF417 or any barcode.

SilverDestiny commented 3 years ago

The older version (16.0.2) is somehow not compatible with Text V2 together for some common SDKs upgrade.

https://user-images.githubusercontent.com/11598375/140551692-2b5e8666-afd2-4ce7-9c07-6b2aeda4cf30.png

I tried this image with com.google.mlkit:barcode-scanning:17.0.0 and it seems detectable in static image mode but very hard in streaming mode. The image resolution needs to set up very high for this high density PDF417 barcode.

I also checked `com.google.mlkit:barcode-scanning:16.0.2 and it looks the older didn't perform better than the latest version. You mean com.google.mlkit:barcode-scanning:17.0.0 performed better and could easily detect this barcode?

rjmangubat23 commented 3 years ago

@SilverDestiny yes so the issue is in streaming mode and I did have to set to very high resolution and did some changes on the initial configuration of the camera.

However, it only worked on the older version (16.0.2) and not the latest one (17.0.0).

And so I am having problems upgrading to Text V2 because it will break the barcode scanner part of our app if I use the older version 16.0.2 and for the latest one (17.0.0) barcode scanning will not work entirely at all.

May I ask your help on this one?

thank you very much in advance!

SilverDestiny commented 2 years ago

Checked within the team and it is expected that the latest SDK may not work with other older SDKs because of the common dependency. We'll work on fixing it on the latest release if this is a regression from the old barcode SDK.

SilverDestiny commented 2 years ago

Close this issue as it's been over 6 months. Please reopen it if anything is needed.