我需要一个库来从C#项目(
windows Forms)上的图像中读取二维条码(datamatrix).
我尝试使用一些SDK,但我尝试的SDK不是免费的.
我尝试使用一些SDK,但我尝试的SDK不是免费的.
有没有免费的SDK可以从图像中读取2d条形码?
解决方法
有一个
example available:
using DataMatrix.net; // Add ref to DataMatrix.net.dll
using System.Drawing; // Add ref to System.Drawing.
[...]
// ---------------------------------------------------------------
// Date 180310
// Purpose Get text from a DataMatrix image.
// Entry sFileName - Name of the barcode file (PNG,+ path).
// Return The text.
// Comments See source,project DataMatrixTest,Program.cs.
// ---------------------------------------------------------------
private string DecodeText(string sFileName)
{
Dmtximagedecoder decoder = new Dmtximagedecoder();
System.Drawing.Bitmap oBitmap = new System.Drawing.Bitmap(sFileName);
List<string> oList = decoder.DecodeImage(oBitmap);
StringBuilder sb = new StringBuilder();
sb.Length = 0;
foreach (string s in oList)
{
sb.Append(s);
}
return sb.ToString();
}
你需要DataMatrix.net!