Reading a 2D barcode from images

I need a library for reading a 2D barcode (datamatrix) from images in a C # project (Windows Forms), I tried it with other sdk, but this sdk is not free. Is there any free sdk for reading 2d barcode from images?

+6
source share
2 answers

There is an example :

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(); } 

You will need DataMatrix.net !

+4
source

The best free Datamatrix coder \ decoder I've used is libdmtx: http://www.libdmtx.org/ . It has a C # shell, so feel free to use it. I can’t write the sample code right now, but if you can’t deal with it yourself, I will help you a bit later with this.

EDIT: libdmtx comes with console utilities - if you can read barcodes using a console application, you will definitely read it using code.

EDIT2: Here are some code examples: http://libdmtx.wikidot.com/libdmtx-net-wrapper

I wonder if you have photos containing any other information besides a barcode. The fact is that I do not know of any free open source library for processing a barcode in a picture containing any other data. And here is a link to other datamatrix implementations: http://www.libdmtx.org/resources.php

+2
source

Source: https://habr.com/ru/post/912825/


All Articles