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.58k stars 2.93k forks source link

[Bug report] cannot recognize special character in Code 93 Extended (Full ASCII Code 93) #560

Open markchanosa opened 2 years ago

markchanosa commented 2 years ago

Describe the bug Special characters are allowed in Code 93 Extended like "", but in mlkit app will not recognize the special character and showing "bO" if this is a "" character. However, in zxing app it can recognize the "_" correctly. Is there any setting it can be used to recognize these special characters?

To Reproduce Example Steps to reproduce the behavior in sample app:

  1. Go to https://products.aspose.app/barcode/generate/code93#result
  2. Select 'Code 93 Extended'
  3. Enter '123_456' in code text
  4. Click on 'Generate Barcode'
  5. Use the sample app 'Barcode Scanning' function to scan the barcode
  6. See incorrect result '123bO456'

If applicable, please include code snippet and sample input(image, video, text, etc) image image

Expected behavior A clear and concise description of what you expected to happen. Showing correct result '123_456'

SDK Info:

Smartphone:

Development Environment: (For Android issue feel free to skip this section)

terryburton commented 4 months ago

ML Kit does not currently claim to support Code 93 Extended, only Code 93.

Nevertheless, the decoding is incorrect. The correct behaviour when encountering the implicit (%) codeword is not to scan when lacking support for extended characters.

So this seems to be both a bug report and a feature request.

pulmuone commented 1 month ago

nuget inall ZXing.Net.Maui.Controls

                        var buffer = iImageProxy.GetPlanes()[0].Buffer;
                        var size = new Size(iImageProxy.Width, iImageProxy.Height);
                        var pb = new PixelBufferHolder { Data = buffer, Size = size };

                        LuminanceSource ls = new ByteBufferYUVLuminanceSource(pb.Data, (int)size.Width, (int)size.Height, 0, 0, (int)size.Width, (int)size.Height);
                        var bitmap = new BinaryBitmap(new HybridBinarizer(ls));

                        ZXing.Net.Maui.Readers.IBarcodeReader barcodeReader = new ZXingBarcodeReader
                        {
                            Options = new BarcodeReaderOptions
                            {
                                Formats = ZXing.Net.Maui.BarcodeFormat.Code93,
                                TryInverted = false,
                                TryHarder = true,
                                AutoRotate = false,
                                Multiple = false
                            }
                        };

                        var barcodes1 = barcodeReader.Decode(pb);
                        if (barcodes1?.Any() ?? false)
                        {
                            foreach (var barcode in barcodes1)
                            {
                                System.Diagnostics.Debug.WriteLine($"Barcodes: {barcode.Format} -> {barcode.Value}");
                                barcodeListerner?.Invoke(new ScannedResult(barcode.Value, barcode.Format.ToString()));
                            }
                        }