googlesamples / mlkit

A collection of sample apps to demonstrate how to use Google's ML Kit APIs on Android and iOS
Apache License 2.0
3.5k stars 2.92k forks source link

[Feature request] barcode-scanning checksum #746

Open andreaMOnline opened 10 months ago

andreaMOnline commented 10 months ago

What's your feature request? Please describe. For applications in the retail industry it is important that the checksum matches for barcodes with a format that has a checksum as a last digit.

Example from our world is an ITF barcode of length 22 for discounted article (perishable goods).

We notice that the checksum is not always valid with the scanner option configuration formats (all formats use Modulo10)

Barcode.FORMAT_EAN_13, Barcode.FORMAT_EAN_8, Barcode.FORMAT_ITF, // interleaved2of5 Barcode.FORMAT_UPC_A

Currently we have to do some validity check additionally in the code which is quite slow.

Request: Modulo10 information as an additional scanner option or checksum flag if checksums are not already calculated.

Mobile environment Android : com.google.mlkit:barcode-scanning version 17.2.0

Additional context When modifying the code for the format ITF in the gsm scanner sample it will still always give the result of code128 which has another modulo and the result is also varying greatly.

Here is a sample of such a barcode in ITF standard with a checksum:

barcode128

We wonder if today OCR scanner would outrun then the barcode scanner results for this particular format because a barcode of greater length is more prone to errors frail in the printing process.

Unfortunately nothing is stated in the documentation which lengths are supported for ITF formats or if checksums are validated already.

bagintz commented 10 months ago

We also have a use case where we need to scan code 39 Modulo43, and it would be nice to have that as an option.