Documentation Portal      

What are you looking for?

Reading a Bar Code Following a Given Symbology

Functional Guide | Reference: SetAdditionalSymbologies, SetVerifyChecksum, Detect, Decode, GetNumDecodedSymbologies

///////////////////////////////////////////////////////////////
// This code snippet shows how to enable a given symbology, //
// enable the checksum verification, perform the bar code //
// detection and retrieve the decoded string. //
///////////////////////////////////////////////////////////////
// Image constructor
EImageBW8 srcImage;
// Bar code reader constructor
EBarCode reader;
// String for the decoded bar code
std::string result;
// ...
// Disable all standard symbologies
reader.SetStandardSymbologies(0);
// Enable the Code32 symbology only
reader.SetAdditionalSymbologies(ESymbologies_Code32);
// Enable checksum verification
reader.SetVerifyChecksum(true);
// Detect all possible meanings of the bar code
reader.Detect(&srcImage);
// Retrieve the number of symbologies for
// which the decoding process was successful
int numDecoded = reader.GetNumDecodedSymbologies();
if(numDecoded > 0)
{
// Decode the bar code according to the Code32 symbology
result = reader.Decode(ESymbologies_Code32);
}
'///////////////////////////////////////////////////////////////
'// This code snippet shows how to enable a given symbology, //
'// enable the checksum verification, perform the bar code //
'// detection and retrieve the decoded string. //
'///////////////////////////////////////////////////////////////
' Image constructor
Dim srcImage As New EImageBW8
' Bar code reader constructor
Dim reader As New EBarCode
' String for the decoded bar code
Dim result As String
' ...
' Disable all standard symbologies
reader.StandardSymbologies = 0
' Enable the Code32 symbology only
reader.AdditionalSymbologies = ESymbologies_Code32
' Enable checksum verification
reader.VerifyChecksum = True
' Detect all possible meanings of the bar code
reader.Detect srcImage
' Retrieve the number of symbologies for
' which the decoding process was successful
Dim numDecoded As Long
numDecoded = reader.NumDecodedSymbologies
If numDecoded > 0 Then
    ' Decode the bar code according to the Code32 symbology
result = reader.Decode(ESymbologies_Code32)
End If
///////////////////////////////////////////////////////////////
// This code snippet shows how to enable a given symbology, //
// enable the checksum verification, perform the bar code //
// detection and retrieve the decoded string. //
///////////////////////////////////////////////////////////////
// Image constructor
EImageBW8 srcImage= new EImageBW8();
// Bar code reader constructor
EBarCode reader= new EBarCode();
// String for the decoded bar code
string result;
// ...
// Disable all standard symbologies
reader.StandardSymbologies= 0;
// Enable the Code32 symbology only
reader.AdditionalSymbologies= (int)ESymbologies.Code32;
// Enable checksum verification
reader.VerifyChecksum= true;
// Detect all possible meanings of the bar code
reader.Detect(srcImage);
// Retrieve the number of symbologies for
// which the decoding process was successful
int numDecoded = reader.NumDecodedSymbologies;
if(numDecoded > 0)
{
// Decode the bar code according to the Code32 symbology
result = reader.Decode(ESymbologies.Code32);
}

Which API shall we display?

© 2019 EURESYS s.a.  -  About Documentation  -  Open Source Licenses  -  Open eVision 2.10.0.1121