ZXing.Net icon indicating copy to clipboard operation
ZXing.Net copied to clipboard

unable to read DataMatrix

Open bayanbader opened this issue 3 years ago • 3 comments

I'm having hard time decoding a certain DM barcode.

  1. this one is decoded just fine: Unknown_Code_img250p0 03

  2. this one is decoded just after I invert and rotate the bitmap manually until i get the code: bcr_dtmx_25

  3. but this one is not working: Unknown_Code

this is the reader: var options = new DecodingOptions() { TryInverted = true, TryHarder = true, AssumeGS1 = true, PossibleFormats = new List<BarcodeFormat>() { BarcodeFormat.QR_CODE, BarcodeFormat.CODE_39, BarcodeFormat.CODE_93, BarcodeFormat.CODE_128, BarcodeFormat.CODABAR, BarcodeFormat.DATA_MATRIX } };

         var reader = new ZXing.BarcodeReader()
        {
            AutoRotate = true,
            Options = options
        };

       zxingResult = reader.Decode(bitmap);

as you can see, the autoRotate=true, but the second barcode is decoded just when I rotate it manualy.

does anyone have an idea what can i do?

bayanbader avatar Oct 31 '22 16:10 bayanbader

Strange images. No chance to make better ones before decoding?

micjahn avatar Nov 01 '22 21:11 micjahn

@micjahn unfortunately no. the images are taking using a camera in production tools. the barcodes are printed in quarts

bayanbader avatar Nov 02 '22 07:11 bayanbader

Datamatrix detection is possibly to blame here. The method in zxing (and in this port) isn’t very good at finding them correctly. Not to make more work for the maintainer here, but porting over the c++ detector (it takes a very different approach to locating datamatrix codes) might help. You can check if this is the case by trying out their reader. (https://github.com/zxing-cpp/zxing-cpp)

hschimke avatar Jan 19 '23 03:01 hschimke