Reading a Mail Bar Code¶
This code snippet shows how to read Mail Bar codes and retrieve the decoded data.
C++¶
#include <eVision/EasyBarCode/EasyMailBarcode/EMailBarcodeReader.h>
using namespace eVision;
// Image constructor
EImageBW8 srcImage;
// Mail barcode reader constructor
EMailBarcodeReader reader;
// Select expected symbologies and orientations (optional)
reader.SetExpectedSymbologies(5);
reader.SetExpectedOrientations(5);
// ...
// Read
std::vector<EMailBarcode> codes = reader.Read(srcImage);
// Retrieve the data included in found mail bar codes
for (unsigned int index = 0; index < codes.size(); index++)
{
std::string text = codes[index].GetText();
std::vector<EStringPair> components = codes[index].GetComponentStrings();
}
See also
C#¶
using eVision;
// Image constructor
EImageBW8 srcImage = new EImageBW8();
// Mail bar code reader constructor
EMailBarcodeReader reader = new EMailBarcodeReader();
// Select expected symbologies and orientations (optional)
reader.ExpectedSymbologies = 5;
reader.ExpectedOrientations = 5;
// ...
// Read
EMailBarcode[] codes = reader.Read(srcImage);
// Retrieve the data included in found mail bar codes
for (int index = 0; index < codes.Length; index++)
{
string text = codes[index].Text;
EStringPair[] components = codes[index].ComponentStrings;
}
See also
Python¶
import eVision
# Image constructor
src_image = eVision.EImageBW8()
# Mail bar code reader constructor
reader = eVision.EMailBarcodeReader()
# Select expected symbologies and orientations (optional)
reader.ExpectedSymbologies = 5
reader.ExpectedOrientations = 5
# ...
# Read
codes = reader.Read(src_image)
# Retrieve the data included in found mail bar codes
for code in codes:
text = code.Text
components = code.ComponentStrings
See also