Data Matrix Code decode returns result null value #589
Replies: 2 comments
-
The main problem is the missing quiet zone around the data matrix code. You should add a small white border around the code or you use the option PureBarcode:
PureBarcode should only be used with “synthetic” images like the one you tried. It is not useful in real scenarios. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi Michael,
thank you, of course with :
public static string DecodeDataMatrixCode(Bitmap bitmap)
{
IBarcodeReader reader = new BarcodeReader()
{
Options = new ZXing.Common.DecodingOptions
{
PossibleFormats = new List<BarcodeFormat> { BarcodeFormat.DATA_MATRIX },
PureBarcode = true
}
};
var result = reader.Decode(bitmap);
return result?.Text;
}
including set PureBarcode = true as you recommend me to set for DMC image wo quiet zone reader.Decore return properly decoded Text.
Thank you again, using of ZXing.net nuget save some time during development & commissioning if it's not necessary test production workflow in factory production applications with real dmc scanners.
Yours sincerely,
Radovan Podhradsky.
INTERNAL
From: Michael Jahn ***@***.***>
Sent: Sunday, February 16, 2025 9:07 PM
To: micjahn/ZXing.Net
Cc: Podhradský, Radovan WP/CKY-ZSIS; Author
Subject: Re: [micjahn/ZXing.Net] Data Matrix Code decode returns result null value (Discussion #589)
Od adresy ***@***.*** nedostávate často e-maily. Zistite, prečo je to dôležité<https://aka.ms/LearnAboutSenderIdentification>
Caution: This email originated from outside the Schaeffler organization.
Ensure you trust this sender before clicking on any links or attachments.
The main problem is the missing quiet zone around the data matrix code. You should add a small white border around the code or you use the option PureBarcode:
...
Options = new ZXing.Common.DecodingOptions
{
PossibleFormats = new List<BarcodeFormat> { BarcodeFormat.DATA_MATRIX },
PureBarcode = true
}
...
PureBarcode should only be used with "synthetic" images like the one you tried. It is not useful in real scenarios.
-
Reply to this email directly, view it on GitHub<#589 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BPHEKEX6BWJUHHBFVKLLNVT2QDVW7AVCNFSM6AAAAABWTPAPUCVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTEMRRG4ZTQNQ>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
I tried to use several appraches to decode DMC generated by online generator https://barcode.tec-it.com/en/DataMatrix which I used with real scanners (Datalogic or Cognex) before. Generated DMC I saved to .bmp or .png files and tied to load using
Bitmap barcodeBitmap = (System.Drawing.Bitmap)System.Drawing.Image.FromFile(dmcFilePath);
or
Bitmap barcodeBitmap = new Bitmap(dmcFilePath);
images are shown properly with
pictureboxBarcode.Image = barcodeBitmap;
I tired these 2 option to decode DMC in bitmap, both returns null result from Decode/decode methods:
testing form usings:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
using ZXing;
using ZXing.Datamatrix;
using ZXing.Common;
.NET Framework 4.8 WinForms testing application with ZXing.Net 0.16.10 nuget installed by NuGet Package Manager.
Dooes somebody have some hints/recommenndations how to decode DMC code generated by
https://barcode.tec-it.com/en/DataMatrix?data=a1234567890112233020250206
successfully?
Beta Was this translation helpful? Give feedback.
All reactions