capawesome-team / capacitor-mlkit

⚡️ ML Kit plugins for Capacitor. Supports Android and iOS.
https://capawesome.io/plugins/mlkit/
Apache License 2.0
147 stars 43 forks source link

EAN13 code detected as UPC-A #139

Closed sertal70 closed 7 months ago

sertal70 commented 7 months ago

Plugin(s)

Version

5.4.0

Platform(s)

Current behavior

EAN13 codes starting with 0 are detected as UPC-A code, dropping the leading 0 in the returned code.

Expected behavior

EAN13 codes should be detected as they are, even when the code starts with 0.

Reproduction

https://github.com/robingenz/capacitor-mlkit-plugin-demo

Steps to reproduce

  1. clone the official capacitor mlkit plugin demo repository
  2. build and start the app
  3. select EAN13 format
  4. scan the following EAN13 code:
image
  1. In the console you'll get:
{"barcode":{"bytes":[49,50,51,52,53,54,55,56,57,48,49,50],"rawValue":"123456789012","valueType":"PRODUCT","cornerPoints":[[277,1003],[270,481],[878,488],[872,998]],"format":"UPC_A","displayValue":"123456789012"}}

Other information

I know that usually an UPC-A code can be "converted" into an EAN13 code by placing a leading 0, so maybe this could be the cause of the error. But the graphical render of a EAN13 code is quite different from an UPC-A code, as one can see from the following comparison:

image

Capacitor doctor

$ npx cap doctor [warn] The bundledWebRuntime configuration option has been deprecated. Can be safely deleted. 💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 5.7.3 @capacitor/core: 5.7.3 @capacitor/android: 5.7.3 @capacitor/ios: 5.7.3

Installed Dependencies:

@capacitor/cli: 5.4.1 @capacitor/core: 5.4.1 @capacitor/android: 5.4.1 @capacitor/ios: 5.4.1

[success] iOS looking great! 👌 [success] Android looking great! 👌

Before submitting

robingenz commented 7 months ago

This should be an issue in the underlying library. Please create an issue in https://github.com/googlesamples/mlkit. This Capacitor plugin is just a wrapper around the ML Kit SDK.