Tuning the Search Parameters Code Snippet¶
This code snippet shows how to explicitly specify the data matrix code logical size and family, perform the reading 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;
// ...
// Remove the default logical sizes
reader.GetSearchParams().ClearLogicalSize();
// Add the 15x15 and 17x17 logical sizes
reader.GetSearchParams().AddLogicalSize(ELogicalSize__15x15);
reader.GetSearchParams().AddLogicalSize(ELogicalSize__17x17);
// Remove the default families
reader.GetSearchParams().ClearFamily();
// Add the ECC050 family
reader.GetSearchParams().AddFamily(EFamily_ECC050);
// 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;
// ...
// Remove the default logical sizes
reader.SearchParams.ClearLogicalSize();
// Add the 15x15 and 17x17 logical sizes
reader.SearchParams.AddLogicalSize(ELogicalSize._15x15);
reader.SearchParams.AddLogicalSize(ELogicalSize._17x17);
// Remove the default families
reader.SearchParams.ClearFamily();
// Add the ECC050 family
reader.SearchParams.AddFamily(EFamily.ECC050);
// 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()
# ...
# Remove the default logical sizes
reader.SearchParams.ClearLogicalSize()
# Add the 15x15 and 17x17 logical sizes
reader.SearchParams.AddLogicalSize(eVision.ELogicalSize._15x15)
reader.SearchParams.AddLogicalSize(eVision.ELogicalSize._17x17)
# Remove the default families
reader.SearchParams.ClearFamily()
# Add the ECC050 family
reader.SearchParams.AddFamily(eVision.EFamily.ECC050)
# Read the source image
mx_code = reader.Read(src_image)
# Retrieve the decoded string
result = mx_code.DecodedString