googlesamples / googlesamples/mlkit

[Bug report] Relatively poor performance for Code 128-B

Open
#758 0 comments 0 reactions 1 assignee Claimed by @zhouyiself View on GitHub
Dominant language
Kotlin
Stars
4.3k
Forks
3.1k
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
When using the MLKit barcode scanner, there is a noticable accuracy difference when comparing a code 128 with Subset B to a code 128 that switches to subset C for a long string of digits.

When scanning the former, the scanner tends to find many more false positives, and the distance from which I can accurately scan the code is noticably shorter than the "optimized" code that switches subsets. Additionally, I notice that the resulting bounding box for the code tends to correctly detect the width of the code, but the height is all over the place (varying from a horizontal line to a well-fitted box around the code).

https://github.com/googlesamples/mlkit/assets/23523399/e36c3bbf-8450-424a-91a3-2d5b471f9a5e

https://github.com/googlesamples/mlkit/assets/23523399/e5428a7d-6899-4702-9361-80e7e2e93580

Note that for both of these clips, the scanning speed was capped at 0.25 seconds, to also make the bounding box behavior a bit clearer.

**To Reproduce**
Example Steps to reproduce the behavior in sample app:
1. Run an app with the MLkit barcode scanner (preferably one that also draws bounding boxes)
2. Scan a code-128 barcode with a number of digits in it, that also has some letters (optimized, like the ones generated on [this website](https://barcode.tec-it.com/en/?data=AB123456848D2)
3. Now scan the same code, but generated with just the subtype B barcode (like the one on [this website](https://www.barcodesinc.com/generator/index.php), where you can select `Code 128-B` under advanced settings)
4. Observe the difference in the resulting scanning speed/bounding boxes.

**Expected behavior**
I expect both of these codes, which essentially contain the same symbols (albeit with a slightly different interpretation depending on the current subset(s)), to behave (almost) identically when scanned.

**SDK Info:**
- implementation 'com.google.mlkit:barcode-scanning:17.2.0'
- I am using the barcode scanner through the `mobile_scanner` package for Flutter: https://github.com/juliansteenbakker/mobile_scanner, but the difference/issue occurs from the MLKit scanner

**Smartphone:**
- Google Pixel 7 (Android 14)
- Google Pixel 6 (Android 14)
And I have noticed the same thing on some other devices too, but I haven't tested them specifically with this exact version.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.