Aspose.BarCode.BarCodeRecognition Namespace
The Aspose.BarCode.BarCodeRecognition contains tools for the 1D/2D barcodes recognition.
Classes
  ClassDescription
Public classCode exampleBarCodeReader
BarCodeReader encapsulates an image which may contain one or several barcodes, it then can perform Read operation to detect barcodes
Examples
Detect an code39 barcode with supplement
[C#]
BarCodeReader reader;
reader = new BarCodeReader(@"c:\test.jpg", DecodeType.Code39Standard); // or new BarCodeReader(@"c:\test.jpg", DecodeType.Code39Standard, DecodeType.Aztec);
while(reader.Read())
{
    Console.WriteLine("BarCode Type: " + reader.GetCodeType());
    Console.WriteLine("BarCode CodeText: " + reader.GetCodeText());
}
reader.Close();

[VB.NET]
Dim reader As BarCodeReader
reader = New BarCodeReader("c:\test.jpg", DecodeType.Code39Standard) 'or New BarCodeReader("c:\test.jpg", DecodeType.Code39Standard, DecodeType.Aztec)
While reader.Read()
Console.WriteLine("BarCode Type: " + reader.GetCodeTypeName())
Console.WriteLine("BarCode CodeText: " + reader.GetCodeText())
End While
reader.Close()
Public classBarCodeReaderPossibleBarCode
Describes possible barcode found. Maybe incorrectly.
Public classBarCodeRecognitionException
General exception thrown by BarCodeReader, inherited from BarCodeException
Public classCode exampleBarCodeRegion
Represents the barcode's region
Examples
Draw edges of the barcode region, then fill it.
[C#]
BarCodeReader reader;
reader = new BarCodeReader(@"c:\test.jpg",BarCodeReadType.Code39Standard);
int counter = 0;
while(reader.Read())
{
    Console.WriteLine("BarCode Type: "+reader.GetReadType());
    Console.WriteLine("BarCode CodeText: " + reader.GetCodeText());
    BarCodeRegion region = reader.GetRegion();
    if(region != null)
    {
        Image img = System.Drawing.Image.FromFile(file);
        Graphics g = Graphics.FromImage(img);
        region.DrawBarCodeEdges(g,new Pen(Color.Red,1f));
        img.Save(string.Format(@".\edge_{0}.png" ,counter++));
        region.FillBarCodeRegion(g,Brushes.Green);
        img.Save(string.Format(@".\fill_{0}.png", counter++));
    }
}
reader.Close();
[VB.NET]
Dim reader As BarCodeReader
reader = New BarCodeReader("c:\test.jpg", BarCodeReadType.Code39Standard)
Dim counter As Integer
While reader.Read()
    counter = counter + 1
    Console.WriteLine("BarCode Type: " + reader.GetReadType().ToString)
    Console.WriteLine("BarCode CodeText: " + reader.GetCodeText())
    Dim region As BarCodeRegion
    region = reader.GetRegion()
    If Not region Is Nothing Then
        Dim img As Image = System.Drawing.Image.FromFile("c:\test.jpg")
        Dim g As Graphics = Graphics.FromImage(img)
        region.DrawBarCodeEdges(g, New Pen(Color.Red, 1.0F))
        img.Save(String.Format(".\edge_{0}.png", counter))
        region.FillBarCodeRegion(g, Brushes.Green)
        img.Save(String.Format(".\fill_{0}.png", counter))
    End If
End While
reader.Close()
Public classBaseDecodeType
Base class for MultyDecodeType and SingleDecodeType.
Public classCode128DataPortion
Contains the data of subtype for Code128 type barcode
Public classCode exampleDecodeType
Specify the type of barcode to read.
Examples
Detect an code39 and Code128 barcode
[C#]
BarCodeReader reader;
reader = new BarCodeReader(@"c:\test.jpg", DecodeType.Code39Standard, DecodeType.Code128);
while (reader.Read())
{
      Console.WriteLine("BarCode Type: " + reader.GetCodeType());
      Console.WriteLine("BarCode CodeText: " + reader.GetCodeText());
}
reader.Close();

[VB.NET]
Dim reader As BarCodeReader
reader = New BarCodeReader("c:\test.jpg", DecodeType.Code39Standard, DecodeType.Code128)
While reader.Read()
Console.WriteLine("BarCode Type: " + reader.GetCodeTypeName())
Console.WriteLine("BarCode CodeText: " + reader.GetCodeText())
End While
reader.Close()
Public classCode exampleMultyDecodeType
Composite decode type.
Public classRecognitionHints
Set recognition hints here.
Public classCode exampleSingleDecodeType
Single decode type. See decode type to get instance.
Interfaces
  InterfaceDescription
Public interfaceICOMBarCodeReader
Interface for COM interop usage.
Enumerations
  EnumerationDescription
Public enumerationCode exampleBarCodeReadType Obsolete.
Specify the type of barcode to read.
Examples
Detect an code39 and Code128 barcode
[C#]
BarCodeReader reader;
reader = new BarCodeReader(@"c:\test.jpg", BarCodeReadType.Code39Standard | BarCodeReadType.Code128);
while(reader.Read())
{
Console.WriteLine("BarCode Type: "+ reader.GetReadType());
Console.WriteLine("BarCode CodeText: " + reader.GetCodeText());
}
reader.Close();
[VB.NET]
Dim reader As BarCodeReader
reader = New BarCodeReader("c:\test.jpg", BarCodeReadType.Code39Standard | BarCodeReadType.Code128)
While reader.Read()
Console.WriteLine("BarCode Type: " + reader.GetReadType())
Console.WriteLine("BarCode CodeText: " + reader.GetCodeText())
End While
reader.Close()
Public enumerationChecksumValidation

Enable checksum validation during recognition for 1D barcodes.

Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible.

Checksum never used: Codabar

Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN

Checksum always used: Rest symbologies

Public enumerationCode128SubType
Contains types of Code128 subset
Public enumerationManualHint
Manual hints.
Public enumerationRecognitionHintsImageBinarization
Image binarization hints.
Public enumerationRecognitionHintsOrientation
Orientation hints.
Public enumerationRecognitionMode
Recognition modes. Note: only one recognition mode can be selected.