Reading a Bar Code Following a Given Symbology Code Snippet¶
This code snippet shows how to enable a given symbology, enable the checksum verification, perform the bar code detection and retrieve the decoded string.
C++¶
#include <eVision/EasyBarCode/EasyBarCode1/EBarCode.h>
using namespace eVision;
// 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);
}
C#¶
using eVision;
// Image constructor
EImageBW8 srcImage = new EImageBW8();
// Bar code reader constructor
eVision.EBarCode reader = new eVision.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
uint numDecoded = reader.NumDecodedSymbologies;
if (numDecoded > 0)
{
// Decode the bar code according to the Code32 symbology
result = reader.Decode(ESymbologies.Code32);
}
Python¶
Warning
This snippet is not available in this language.