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

Barcode scanner detected wrong barcode sometimes #1130

Closed
longld103 opened this issue Jun 17, 2020 · 8 comments
Closed

Barcode scanner detected wrong barcode sometimes #1130

longld103 opened this issue Jun 17, 2020 · 8 comments

Comments

@longld103
Copy link

failed

These are results of detector. String 1209-002558GK28E21060524860000321 is correct

1209-002558GK28E21060524860000321
1209-002558GK28E21060524860000321
1209-, 9ZGK18E210523242150321
1209-002558GK28E21060524860000321
1209-002558GK28E21060524860000321
3410702717477
1209-002558GK28E21060524860000321
1209-002558GK28E21060524860000321
1209-002558GK28E21060524860000321
1209-, 9ZGK18E210523242150321
1209-002558GK28E21060524860000321
1209-002558GK28E21060524860000321
1209-002558GK28E21060524860000321
1209-002558GK28E21060524860000321
1209-002558GK28E21060524860000321

@google-oss-bot
Copy link

This issue does not seem to follow the issue template. Make sure you provide all the required information.

@longld103
Copy link
Author

@zhouyiself Could you help me check

@samtstern
Copy link
Contributor

@longld103 it looks like you have the correct result the majority of the time, can you explain what the issue is?

Please use the issue template when filing issue.s

@longld103
Copy link
Author

Step 1: Describe your environment

  • Android device: Samsung galaxy note10 (N975F)
  • Android OS version: Android 10
  • Google Play Services version: com.google.gms:google-services:4.3.3
  • Firebase/Play Services SDK version: com.google.firebase:firebase-ml-vision:24.0.3

Step 2: Describe the problem:

I'm using camera2 api, get bitmap from onImageAvaiable function > put the bitmap to firebase barcode detector

Steps to reproduce:

  1. live stream camera view and focus to the barcode

Observed Results:

  • These are results of detector. String 1209-002558GK28E21060524860000321 is correct

1209-002558GK28E21060524860000321
1209-002558GK28E21060524860000321
1209-, 9ZGK18E210523242150321
1209-002558GK28E21060524860000321
1209-002558GK28E21060524860000321
3410702717477
1209-002558GK28E21060524860000321
1209-002558GK28E21060524860000321
1209-002558GK28E21060524860000321
1209-, 9ZGK18E210523242150321
1209-002558GK28E21060524860000321
1209-002558GK28E21060524860000321
1209-002558GK28E21060524860000321
1209-002558GK28E21060524860000321
1209-002558GK28E21060524860000321

Expected Results:

  • always return 1209-002558GK28E21060524860000321 string value

Relevant Code:

This is my code:
firebaseDetector = FirebaseVision.getInstance().getVisionBarcodeDetector();
and
firebaseDetector.detectInImage(image)

@samtstern
Copy link
Contributor

@longld103 the correct response is returned 12/15 frames. Unfortunately there's no way to guarantee you get the correct response on every single frame, especially when the source image is imperfect (like yours).

I would suggest waiting until you get the same response in two frames, that way you know it's right.

@longld103
Copy link
Author

longld103 commented Jun 19, 2020

Hi @samtstern
When I tested with high quality image, the issue still occur but wrong rate down to <1%.
FirebaseBarcodeScanner is great however it not have trust 100%
So the point of the issue is input image not good or FirebaseBarcodeScanner can't decode correct 100%?

Screen Shot 2020-06-19 at 8 15 52 AM

these are results:

1209-002558GK28E21060524860000321
1209-002558GK28E21060524860000321
1118188288888
1209-002558GK28E21060524860000321
1209-002558GK28E21060524860000321
9122181222222
1209-002558GK28E21060524860000321
1209-002558GK28E21060524860000321

@samtstern
Copy link
Contributor

@longld103 thank you for trying again with a higher-quality image, that's really helpful.

Unfortunately we can't count on 100% accuracy for MLKit because there are too many factors:

  • Phone cameras
  • Lenses and focus distance
  • Variable "correct" bar code widths

I would suggest the following ways to make your application more resilient:

  • Wait until you get two results that are the same, it is highly likely that's correct.
  • If you know the size of the barcode you're expecting, wait until you get a result of the right length.

@longld103
Copy link
Author

@samtstern Thank for your reply. MLKit is wonderful 😘

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

No branches or pull requests

3 participants