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

[Bug report] EAN13 code starting with 0 detected as UPC-A #797

Open
sertal70 opened this issue Mar 21, 2024 · 2 comments
Open

[Bug report] EAN13 code starting with 0 detected as UPC-A #797

sertal70 opened this issue Mar 21, 2024 · 2 comments
Assignees

Comments

@sertal70
Copy link

sertal70 commented Mar 21, 2024

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"
  3. Take a photo of this EAN13 code:

image

  1. Tap on "Detect"
  2. 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:

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:

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:

$ 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
@JavaLavaMT
Copy link

JavaLavaMT commented Mar 27, 2024

I like this issue, but for now

https://react-native-vision-camera.com/docs/guides/code-scanning#upc-a-vs-ean-13-codes

"You will need to keep this in mind and do the conversion from EAN-13 to UPC-A yourself. This can be done by removing the front 0 digit from the code to get a UPC-A code."

I am sure they would take a PR for a fix

@sertal70
Copy link
Author

@JavaLavaMT the issue is actually the opposite: I ask the library to recognize an EAN-13 code but it returns an UPC-A code, which it is not what I asked and it is not what I scanned.

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

No branches or pull requests

4 participants
@zhouyiself @sertal70 @JavaLavaMT and others