Grading a QR Code¶
This code snippet shows how to read a QR code and retrieve its print quality grades.
C++¶
#include <eVision/EasyQRCode/EQRCodeReader.h>
using namespace eVision;
// Load an image
EImageBW8 image;
image.Load("image.bmp");
// Prepare a qr code reader
EQRCodeReader reader;
// Tell the reader to compute grades for the codes read
reader.SetComputeGrading(true);
// Read the codes in this image
std::vector<EQRCode> codes = reader.Read(image);
// Retrieve the detected codes
// Retrieve the ISO15415 grades of the first code
EQRCodeIso15415GradingParameters grades = codes[0].GetIso15415GradingParameters();
// Retrieve the scan grade of the code
int scanGrade = grades.ScanGrade;
C#¶
using eVision;
// Load an image
EImageBW8 image = new EImageBW8();
image.Load("image.bmp");
// Prepare a qr code reader
EQRCodeReader reader = new EQRCodeReader(); ;
// Tell the reader to compute grades for the codes read
reader.ComputeGrading = true;
// Read the codes in this image
EQRCode[] codes = reader.Read(image);
// Retrieve the detected codes
// Retrieve the ISO15415 grades of the first code
EQRCodeIso15415GradingParameters grades = codes[0].Iso15415GradingParameters;
// Retrieve the scan grade of the code
int scanGrade = grades.ScanGrade;
Python¶
import eVision
# Load an image
image = eVision.EImageBW8()
image.Load("image.bmp")
# Prepare a qr code reader
reader = eVision.EQRCodeReader()
# Tell the reader to compute grades for the codes read
reader.ComputeGrading = True
# Read the codes in this image
codes = reader.Read(image)
# Retrieve the detected codes
# Retrieve the ISO15415 grades of the first code
grades = codes[0].Iso15415GradingParameters
# Retrieve the scan grade of the code
scanGrade = grades.ScanGrade
See also
EQRCodeReader.Read C++ .NET, EQRCodeReader.ComputeGrading C++ .NET