Retrieving Information of a QR Code

This code snippet shows how to read a QR code and retrieve the associated information.

C++

#include <eVision/EasyQRCode/EQRCodeReader.h>
using namespace eVision;

// Image constructor
EImageBW8 srcImage;

// QR code reader constructor
EQRCodeReader reader;

// ...

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

// Retrieve version, model and position information
// of the first QR code found, if one was found
if (qrCodes.size() > 0)
{
  int version = qrCodes[0].GetVersion();
  EQRCodeModel model = qrCodes[0].GetModel();
  EQRCodeGeometry geometry = qrCodes[0].GetGeometry();
}

C#

using eVision;
// Image constructor
EImageBW8 srcImage = new EImageBW8();

// QR code reader constructor
EQRCodeReader reader = new EQRCodeReader();

// ...

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

// Retrieve version, model and position information
// of the first QR code found, if one was found
if (qrCodes.Length > 0)
{
  uint version = qrCodes[0].Version;
  EQRCodeModel model = qrCodes[0].Model;
  EQRCodeGeometry geometry = qrCodes[0].Geometry;
}

Python

import eVision
# Image constructor
src_image = eVision.EImageBW8()

# QR code reader constructor
reader = eVision.EQRCodeReader()

# ...

# Read
qr_codes = reader.Read(src_image)

# Retrieve version, model and position information
# of the first QR code found, if one was found
if len(qr_codes) > 0:
    version = qr_codes[0].Version
    model = qr_codes[0].Model
    geometry = qr_codes[0].Geometry