Reading a Data Matrix Code Code Snippet¶
This code snippet shows how to read a data matrix code and retrieve the decoded string.
C++¶
#include <eVision/EasyMatrixCode/EasyMatrixCode1/EMatrixCodeReader.h>
using namespace eVision;
// Image constructor
EImageBW8 srcImage;
// Matrix code reader constructor
EMatrixCodeReader reader;
// Matrix code constructor
EMatrixCode mxCode;
// String for the decoded information
std::string result;
// ...
// Read the source image
mxCode = reader.Read(srcImage);
// Retrieve the decoded string
result = mxCode.GetDecodedString();
C#¶
using eVision;
// Image constructor
EImageBW8 srcImage = new EImageBW8();
// Matrix code reader constructor
EMatrixCodeReader reader = new EMatrixCodeReader();
// Matrix code constructor
EMatrixCode mxCode = new EMatrixCode();
// String for the decoded information
string result;
// ...
// Read the source image
mxCode = reader.Read(srcImage);
// Retrieve the decoded string
result = mxCode.DecodedString;
Python¶
import eVision
# Image constructor
src_image = eVision.EImageBW8()
# Matrix code reader constructor
reader = eVision.EMatrixCodeReader()
# Matrix code constructor
mx_code = eVision.EMatrixCode()
# ...
# Read the source image
mx_code = reader.Read(src_image)
# Retrieve the decoded string
result = mx_code.DecodedString