googlesamples / googlesamples/mlkit
[Bug report] EAN13 code starting with 0 detected as UPC-A
- Dominant language
- Kotlin
- Stars
- 4.3k
- Forks
- 3.1k
- PR merge metrics
- No merged PRs in 30d
Description
EAN13 codes starting with 0 are detected as UPC-A code, dropping the leading 0 in the returned code.
**To Reproduce**
Example Steps to reproduce the behavior in sample app:
1. launch the example app (I used the iOS version but it doesn't matter)
2. Select "Barcode Scanning"
4. Take a photo of this EAN13 code:

6. Tap on "Detect"
7. See result code: it is missing the initial 0 digit
I have modified the source to print out also the format of the detected code.
Here is the result using an EAN13 starting with 0:

As you can see the detected format is 512, which is UPC-A.
Here is the result using an EAN13 not starting with 0:

The detected format is 32, which is EAN13.
**Expected behavior**
EAN13 codes should be detected as they are, even when the code starts with 0.
**SDK Info:**
I'm not sure how to get this info, I simply run `pod install` and this is the result:
```bash
$ pod install
Analyzing dependencies
Downloading dependencies
Installing GTMSessionFetcher (3.3.1)
Installing GoogleDataTransport (9.4.1)
Installing GoogleMLKit (5.0.0)
Installing GoogleToolboxForMac (2.3.2)
Installing GoogleUtilities (7.13.0)
Installing GoogleUtilitiesComponents (1.1.0)
Installing MLImage (1.0.0-beta5)
Installing MLKitBarcodeScanning (4.0.0)
Installing MLKitCommon (10.0.0)
Installing MLKitFaceDetection (4.0.0)
Installing MLKitImageLabeling (4.0.0)
Installing MLKitImageLabelingCommon (6.0.0)
Installing MLKitImageLabelingCustom (4.0.0)
Installing MLKitObjectDetection (4.0.0)
Installing MLKitObjectDetectionCommon (6.0.0)
Installing MLKitObjectDetectionCustom (4.0.0)
Installing MLKitPoseDetection (1.0.0-beta12)
Installing MLKitPoseDetectionAccurate (1.0.0-beta12)
Installing MLKitPoseDetectionCommon (1.0.0-beta12)
Installing MLKitSegmentationCommon (1.0.0-beta10)
Installing MLKitSegmentationSelfie (1.0.0-beta10)
Installing MLKitTextRecognition (3.0.0)
Installing MLKitTextRecognitionChinese (2.0.0)
Installing MLKitTextRecognitionCommon (2.0.0)
Installing MLKitTextRecognitionDevanagari (2.0.0)
Installing MLKitTextRecognitionJapanese (2.0.0)
Installing MLKitTextRecognitionKorean (2.0.0)
Installing MLKitVision (6.0.0)
Installing MLKitVisionKit (7.0.0)
Installing MLKitXenoCommon (1.0.0-beta12)
Installing PromisesObjC (2.4.0)
Installing nanopb (2.30910.0)
```
**Smartphone:**
- Device: iPhone7 plus
**Development Environment:**
*(For Android issue feel free to skip this section)*
- IDE Eversion: Xcode 15.3
- Laptop: MacBook Pro
- Laptop OS/version: macOS 14.4
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.