Retrieving the Decoded Data (Advanced)

Functional Guide | Reference: Read, EQRCode Class

////////////////////////////////////////////////////
// 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;

// QR code reader constructor
EQRCodeReader reader;
// ... 

// Set the source image
reader.SetSearchField(srcImage);

// Read
std::vector<EQRCode> qrCodes = reader.Read();

// 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();
vector<UINT8> bitstream = stream.GetRawBitstream();

// Retrieve the encoding and the decoded data of each part of the first QR code found
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
  vector<UINT8> decodedData = parts[i].GetDecodedData();

  // Interpret the decoded data based on the retrieved encoding
  ...
} 
////////////////////////////////////////////////////
// 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();

// ...

// Set the source image
reader.SearchField = srcImage;

// Read
EQRCode [] qrCodes = reader.Read();

// 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
  ...
}