Retrieving the Decoded Data (Advanced)
Functional Guide | Reference: Read, GetDecodedStream, GetDecodedData, GetCodingMode, GetDecodedStreamParts
using Euresys.Open_eVision;
static partial class Snippet
{
static void RetrievingTheDecodedDataAdvanced()
{
////////////////////////////////////////////////////
// This code snippet shows how to read a QR code //
// and retrieve its coding mode, //
// the raw bit stream and the data part by part //
////////////////////////////////////////////////////
// Image constructor
EImageBW8 srcImage = new EImageBW8();
// QR code reader constructor
EQRCodeReader reader = new EQRCodeReader();
// ...
// Read
EQRCode[] qrCodes = reader.Read(srcImage);
// Retrieve the data stream of the first QR code found
EQRCodeDecodedStream stream = qrCodes[0].DecodedStream;
// Retrieve the coding mode and the raw bit stream of the first QR code found
EQRCodeCodingMode codingMode = stream.CodingMode;
byte[] bitstream = stream.RawBitstream;
// Retrieve the encoding and the decoded data of each part of the first QR code found
EQRCodeDecodedStreamPart[] parts = stream.DecodedStreamParts;
for (uint i = 0; i < parts.Length; ++i)
{
// Retrieve encoding
EQRCodeEncoding encoding = parts[i].Encoding;
// Retrieve the decoded data
byte[] decodedData = parts[i].DecodedData;
// Interpret the decoded data based on the retrieved encoding
}
}
}
#include <Open_eVision.h>
void RetrievingTheDecodedDataAdvanced()
{
////////////////////////////////////////////////////
// This code snippet shows how to read a QR code //
// and retrieve its coding mode, //
// the raw bit stream and the data part by part //
////////////////////////////////////////////////////
using namespace Euresys::Open_eVision;
// Image constructor
EImageBW8 srcImage;
// QR code reader constructor
EQRCodeReader reader;
// ...
// Read
std::vector<EQRCode> qrCodes = reader.Read(srcImage);
// Retrieve the data stream of the first QR code found
EQRCodeDecodedStream stream = qrCodes[0].GetDecodedStream();
// Retrieve the coding mode and the raw bit stream of the first QR code found
EQRCodeCodingMode codingMode = stream.GetCodingMode();
std::vector<UINT8> bitstream = stream.GetRawBitstream();
// Retrieve the encoding and the decoded data of each part of the first QR code found
std::vector<EQRCodeDecodedStreamPart> parts = stream.GetDecodedStreamParts();
for (unsigned int i = 0; i < parts.size(); ++i)
{
// Retrieve encoding
EQRCodeEncoding encoding = parts[i].GetEncoding();
// Retrieve the decoded data
std::vector<UINT8> decodedData = parts[i].GetDecodedData();
// Interpret the decoded data based on the retrieved encoding
}
}
def RetrievingTheDecodedDataAdvanced():
####################################################
## This code snippet shows how to read a QR code ##
## and retrieve its coding mode, ##
## the raw bit stream and the data part by part ##
####################################################
import open_evision as oev
# Image constructor
src_image = oev.EImageBW8()
# QR code reader constructor
reader = oev.EQRCodeReader()
# ...
# Read
qr_codes = reader.Read(src_image)
# Retrieve the data stream of the first QR code found
stream = qr_codes[0].DecodedStream
# Retrieve the coding mode and the raw bit stream of the first QR code found
coding_mode = stream.CodingMode
bitstream = stream.RawBitstream
# Retrieve the encoding and the decoded data of each part of the first QR code found
parts = stream.DecodedStreamParts
for part in parts:
# Retrieve encoding
encoding = part.Encoding
# Retrieve the decoded data
decoded_data = part.DecodedData
# Interpret the decoded data based on the retrieved encoding