This chapter shows how to get started with the TIS Barcode SDK using the .Net component.
Create a new C# project, select Windows Forms Application.
In order to add the TIS Barcode SDK reference, right click the Reference folder in the solution view and choose Add Reference....
Select the Browse tab in the Add Reference dialog box. Then click Browse... and select documents\Tis Barcode SDK\bin\dotnet\v2.0\x86\TIS.Imaging.Barcode.dll from the Barcode SDK installation directory.
Add the TIS Barcode SDK namespace to the list of using directives at the top of your source code file.
[C#]
using TIS.Imaging.Barcode;
The BarcodeScanner class provides the main functionality for barcode recognition.
[C#]
// Creating the BarcodeScanner instance private BarcodeScanner _scanner = new BarcodeScanner(); private void Form1_Load(object sender, EventArgs e) { // Enable optional checksum. _scanner.Options.EnableCheckSum = true; // Specify supported formats. _scanner.Options.SupportedTypes.Add(BarcodeFormat.CODE_39); _scanner.Options.SupportedTypes.Add(BarcodeFormat.CODE_128); }
The barcode recognition is performed automatically using the BarcodeScanner instance. Calling the FindBarcodes method starts the recognition process and returns an array of BarcodeResult objects containing the recognized barcodes.
[C#]
private void PrintBarcodes(Bitmap image) { var results = _barcodeScanner.FindBarcodes(image); if(results != null) { foreach( var result in results) { System.Console.WriteLine(result.Text); } } }
⋯
⋯ ⋯
Established in 1988, The Imaging Source is one of the leading manufacturers of industrial cameras, video converters and embedded vision components for factory automation, quality assurance, medicine, science, security and a variety of other markets.
Our comprehensive range of cameras with USB 3.1, USB 3.0, USB 2.0, GigE, MIPI interfaces and other innovative machine vision products are renowned for their high quality and ability to meet the performance requirements of demanding applications.