我需要一个库来从C#项目(windows Forms)上的图像中读取二维条码(datamatrix).我尝试使用一些SDK,但我尝试的SDK不是免费的.
有没有免费的SDK用于从图像中读取2d条形码?
小智 5
有一个可用的例子:
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();
}
Run Code Online (Sandbox Code Playgroud)
您需要DataMatrix.net!
| 归档时间: |
|
| 查看次数: |
22498 次 |
| 最近记录: |