Тесты качества печати штрих-кодов
В этом разделе
SDK содержит тесты, позволяющие определить качество печати одномерных линейных штрих-кодов, двумерных матричных штрих-кодов (Aztec, DataMatrix, Han Xin Code, QR Code, Micro QR Code) и двумерных многострочных штрих-кодов с возможностью сканирования между строками (PDF417, PDF417Compact, MicroPDF417).
Для тестирования
качества печати одномерных линейных штрих-кодов
необходимо использовать класс
ISO15416QualityTest.
Алгоритм тестирования основан на ISO/IEC 15416 (третье издание). Тест позволяет оценить качество печати штрих-кода, используя следующие параметры:
- Decode - указывает, успешно ли декодировано значение штрих-кода
- Max Reflectance (Rmax) - наивысшая отражательная способность любого элемента или тихой зоны в профиле отражательной способности сканирования
- Min Reflectance (Rmin) - наименьшая отражательная способность любого элемента в профиле отражательной способности сканирования, в процентах
- Symbol Contrast (SC) - контрастность символов, в процентах отражательной способности (разница между наивысшим и наинизшим значением отражательной способности в области символа)
- Min Edge Contrast (ECmin) - минимальная разница в значении отражательной способности между любым конкретным пространством (включая тихие зоны) и прилегающей к нему полосой внутри символа штрих-кода
- Modulation (MOD) - показатель равномерности отражения темных и светлых элементов соответственно (MOD = ECmin/SC)
- Max Element Reflectance Non-uniformity (ERNmax) - максимальная разница в отражательной способности между самым высоким пиком и самым низким значением внутри элемента (полосы или промежутка) символа штрих-кода
- Defects - показатель или отношение максимальной неравномерности отражения элемента к контрасту символа (Дефекты = ERNmax / SC)
- Decodability - показатель точности напечатанного символа штрих-кода по отношению к соответствующему эталонному алгоритму декодирования
Вот пример C#/VB.NET кода, показывающий, как проверить качество печати одномерных штрих-кодов:
using System;
using Vintasoft.Imaging;
using Vintasoft.Barcode;
using Vintasoft.Barcode.BarcodeInfo;
using Vintasoft.Barcode.QualityTests;
/// <summary>
/// Test that shows how to test the print quality of 1D barcodes.
/// </summary>
class ISO15416QualityTestExample
{
/// <summary>
/// Runs the test.
/// </summary>
public static void Test(string filename)
{
// load image with barcode from file
using (VintasoftBitmap barcodeImage = ImageCodecs.Default.Decode(filename))
{
// read barcodes from image and test the print quality of 1D barcodes
ReadBarcodesAndTestBarcodePrintQuality(barcodeImage);
}
}
/// <summary>
/// Reads barcodes from image and tests the print quality of 1D barcodes.
/// </summary>
static void ReadBarcodesAndTestBarcodePrintQuality(VintasoftBitmap imageWithBarcodes)
{
// create the barcode reader
using (BarcodeReader reader = new BarcodeReader())
{
// specify that reader must collect information for quality test
reader.Settings.CollectTestInformation = true;
// specify that reader must search for Code39 and Code128 barcodes only
reader.Settings.ScanBarcodeTypes = BarcodeType.Code39 | BarcodeType.Code128;
// read barcodes
IBarcodeInfo[] barcodeInfos = reader.ReadBarcodes(imageWithBarcodes);
// for each found barcode
for (int i = 0; i < barcodeInfos.Length; i++)
{
// test print quality of barcode using ISO 15416 test
ISO15416QualityTest test =
new ISO15416QualityTest((BarcodeInfo1D)barcodeInfos[i], imageWithBarcodes);
// print results of ISO 15416 test
Console.WriteLine(string.Format("[{0}] {1}",
barcodeInfos[i].BarcodeType, barcodeInfos[i].Value));
Console.WriteLine(string.Format("Overall symbol grade: {0}", test.OverallSymbolGrade));
if (test.DifferentDecodedValues)
Console.WriteLine("Scan profiles has different barcode decode values!");
if (test.SymbolComponentQualityTests.Length == 1)
{
ISO15416SymbolComponentQualityTest qualityTest = test.SymbolComponentQualityTests[0];
Console.WriteLine(string.Format("Scan reflectance profiles: {0}",
qualityTest.ScanReflectanceProfiles.Length));
Console.WriteLine("Scan reflectance profile grades:");
for (int j = 0; j < qualityTest.ScanReflectanceProfiles.Length; j++)
Console.Write(qualityTest.ScanReflectanceProfiles[j].ScanGrade.AlphabeticGrade);
}
else
{
for (int k = 0; k < test.SymbolComponentQualityTests.Length; k++)
{
Console.WriteLine(string.Format("Symbol component: {0}", k + 1));
ISO15416SymbolComponentQualityTest qualityTest = test.SymbolComponentQualityTests[k];
Console.WriteLine(string.Format("Scan reflectance profiles: {0}",
qualityTest.ScanReflectanceProfiles.Length));
Console.WriteLine("Scan reflectance profile grades:");
for (int j = 0; j < qualityTest.ScanReflectanceProfiles.Length; j++)
Console.Write(qualityTest.ScanReflectanceProfiles[j].ScanGrade.AlphabeticGrade);
}
}
Console.WriteLine();
Console.WriteLine();
}
}
}
}
Imports Vintasoft.Imaging
Imports Vintasoft.Barcode
Imports Vintasoft.Barcode.BarcodeInfo
Imports Vintasoft.Barcode.QualityTests
''' <summary>
''' Test that shows how to test the print quality of 1D barcodes.
''' </summary>
Class ISO15416QualityTestExample
''' <summary>
''' Runs the test.
''' </summary>
Public Shared Sub Test(filename As String)
' load image with barcode from file
Using barcodeImage As VintasoftBitmap = ImageCodecs.[Default].Decode(filename)
' read barcodes from image and test the print quality of 1D barcodes
ReadBarcodesAndTestBarcodePrintQuality(barcodeImage)
End Using
End Sub
''' <summary>
''' Reads barcodes from image and tests the print quality of 1D barcodes.
''' </summary>
Private Shared Sub ReadBarcodesAndTestBarcodePrintQuality(imageWithBarcodes As VintasoftBitmap)
' create the barcode reader
Using reader As New BarcodeReader()
' specify that reader must collect information for quality test
reader.Settings.CollectTestInformation = True
' specify that reader must search for Code39 and Code128 barcodes only
reader.Settings.ScanBarcodeTypes = BarcodeType.Code39 Or BarcodeType.Code128
' read barcodes
Dim barcodeInfos As IBarcodeInfo() = reader.ReadBarcodes(imageWithBarcodes)
' for each found barcode
For i As Integer = 0 To barcodeInfos.Length - 1
' test print quality of barcode using ISO 15416 test
Dim test As New ISO15416QualityTest(DirectCast(barcodeInfos(i), BarcodeInfo1D), imageWithBarcodes)
' print results of ISO 15416 test
Console.WriteLine(String.Format("[{0}] {1}", barcodeInfos(i).BarcodeType, barcodeInfos(i).Value))
Console.WriteLine(String.Format("Overall symbol grade: {0}", test.OverallSymbolGrade))
If test.DifferentDecodedValues Then
Console.WriteLine("Scan profiles has different barcode decode values!")
End If
If test.SymbolComponentQualityTests.Length = 1 Then
Dim qualityTest As ISO15416SymbolComponentQualityTest = test.SymbolComponentQualityTests(0)
Console.WriteLine(String.Format("Scan reflectance profiles: {0}", qualityTest.ScanReflectanceProfiles.Length))
Console.WriteLine("Scan reflectance profile grades:")
For j As Integer = 0 To qualityTest.ScanReflectanceProfiles.Length - 1
Console.Write(qualityTest.ScanReflectanceProfiles(j).ScanGrade.AlphabeticGrade)
Next
Else
For k As Integer = 0 To test.SymbolComponentQualityTests.Length - 1
Console.WriteLine(String.Format("Symbol component: {0}", k + 1))
Dim qualityTest As ISO15416SymbolComponentQualityTest = test.SymbolComponentQualityTests(k)
Console.WriteLine(String.Format("Scan reflectance profiles: {0}", qualityTest.ScanReflectanceProfiles.Length))
Console.WriteLine("Scan reflectance profile grades:")
For j As Integer = 0 To qualityTest.ScanReflectanceProfiles.Length - 1
Console.Write(qualityTest.ScanReflectanceProfiles(j).ScanGrade.AlphabeticGrade)
Next
Next
End If
Console.WriteLine()
Console.WriteLine()
Next
End Using
End Sub
End Class
Для тестирования
качества печати двумерных матричных штрих-кодов (Aztec, DataMatrix, Han Xin Code, QR Code, Micro QR Code)
, необходимо использовать
ISO15415QualityTest класс.
Алгоритм тестирования основан на ISO/IEC 15415 (третье издание). Тест позволяет оценить качество печати штрих-кода, используя следующие параметры:
- Decode - указывает, успешно ли декодировано значение штрих-кода
- Max Reflectance (Rmax) - наивысшая отражательная способность любого элемента или тихой зоны в профиле отражательной способности сканирования
- Min Reflectance (Rmin) - наименьшая отражательная способность любого элемента в профиле отражательной способности сканирования, в процентах
- Symbol Contrast (SC) - разница между самым высоким и самым низким значением отражательной способности в области символа;
- Modulation (MOD) - показатель равномерности отражательной способности темных и светлых модулей соответственно;
- Рост печати (PG) - проверяет, не увеличились ли или не уменьшились ли графические элементы, составляющие символ, настолько, чтобы это препятствовало читаемости в менее благоприятных условиях съемки, чем условия тестирования.
- Fixed Pattern Damage - повреждение шаблона поиска, тихой зоны, синхронизации, навигации и других фиксированных шаблонов в символе;
- Axial Nonuniformity - измеряет расстояние между центрами отображения, т.е. точками выборки или пересечениями сетки, полученной путем применения эталонного алгоритма декодирования к бинаризованному изображению.в направлении каждой из основных осей сетки
- Grid Nonuniformity - измеряет наибольшее векторное отклонение точек пересечения сетки, определяемое алгоритмом декодирования эталонного изображения данного символа, от их идеального теоретического положения
- Unused Error Correction (UEC) - проверяет, насколько региональные или точечные повреждения символа снизили запас безопасности считывания, обеспечиваемый коррекцией ошибок
- Quiet Zone - проверяет тихую зону, для которой требуется спецификация символики штрих-кода
- Additional Grades - дополнительные оценки (зависят от символики штрих-кода, см. ниже)
- Distortion Angle - угол искажения (информативный), угол искажения - это величина отклонения от соотношения 90 (градусов) между строкой и столбцом матрицы штрих-кода или осями X и Y
Дополнительные оценки для
Data Matrix
штрих-код (определен в Приложении M стандарта ISO 16022):
- FixedPatternDamage.L1 - степень повреждения сегмента L1
- FixedPatternDamage.L2 - степень повреждения сегмента L2
- FixedPatternDamage.QZL1 - степень повреждения сегмента QZL1
- FixedPatternDamage.QZL2 - степень повреждения сегмента QZL2
- FixedPatternDamage.Segment_X_Y_Top - степень повреждения верхнего выравнивающего шаблона (тактовая дорожка и сплошная область) области данных, расположенной по заданным индексам (X, Y)
- FixedPatternDamage.Segment_X_Y_Right - степень повреждения правого выравнивающего шаблона (тактовая дорожка и сплошная область) данных область, расположенная по указанным индексам (X, Y)
- FixedPatternDamage.ClockAndSolidArea - оценка всех шаблонов выравнивания областей данных
- FixedPatternDamage.AG - оценка среднего значения L1, L2, QZL1, QZL2, ClockAndSolidArea
Вот пример C#/VB.NET кода, который показывает как протестировать качество печати двумерных матричных штрих-кодов (Aztec, DataMatrix, Han Xin Code, QR Code, Micro QR Code):
using System;
using Vintasoft.Imaging;
using Vintasoft.Barcode;
using Vintasoft.Barcode.BarcodeInfo;
using Vintasoft.Barcode.QualityTests;
/// <summary>
/// Test that shows how to test the print quality of matrix 2D barcodes
/// (Aztec, DataMatrix, Han Xin Code, QR and MicroQR).
/// </summary>
class ISO15415QualityTestMatrixBarcodeExample
{
/// <summary>
/// Runs the test.
/// </summary>
public static void Test(string filename)
{
// load image with barcode from file
using (VintasoftBitmap barcodeImage = ImageCodecs.Default.Decode(filename))
{
// read barcodes from image and test the print quality of 2D barcodes
ReadBarcodesAndTestBarcodePrintQuality(barcodeImage);
}
}
/// <summary>
/// Reads barcodes from image and tests the print quality of 2D barcodes.
/// </summary>
public static void ReadBarcodesAndTestBarcodePrintQuality(VintasoftBitmap imageWithBarcodes)
{
// create the barcode reader
using (BarcodeReader reader = new BarcodeReader())
{
// specify that reader must collect information for quality test
reader.Settings.CollectTestInformation = true;
// specify that reader must search for Aztec, DataMatrix, Han Xin Code, QR and MicroQR barcodes only
reader.Settings.ScanBarcodeTypes =
BarcodeType.Aztec | BarcodeType.DataMatrix |
BarcodeType.QR | BarcodeType.MicroQR | BarcodeType.HanXinCode;
// read barcodes
IBarcodeInfo[] barcodeInfos = reader.ReadBarcodes(imageWithBarcodes);
// for each found barcode
for (int i = 0; i < barcodeInfos.Length; i++)
{
// test print quality of barcode using ISO 15415 test
ISO15415QualityTest test = new ISO15415QualityTest();
test.CalculateGrades((BarcodeInfo2D)barcodeInfos[i], imageWithBarcodes);
// print results of ISO 15415 test
Console.WriteLine(string.Format("[{0}] {1}",
barcodeInfos[i].BarcodeType, barcodeInfos[i].Value));
Console.WriteLine(string.Format("Decode : {0}", test.Decode));
Console.WriteLine(string.Format("Unused error correction : {0} ({1})", test.UnusedErrorCorrection, test.UnusedErrorCorrection.ValueText));
Console.WriteLine(string.Format("Symbol contrast : {0} ({1})", test.SymbolContrast, test.SymbolContrast.ValueText));
Console.WriteLine(string.Format("Axial nonuniformity : {0} ({1})", test.AxialNonuniformity, test.AxialNonuniformity.ValueText));
Console.WriteLine(string.Format("Grid nonuniformity : {0} ({1})", test.GridNonuniformity, test.GridNonuniformity.ValueText));
Console.WriteLine(string.Format("Modulation : {0}", test.Modulation));
Console.WriteLine(string.Format("Fixed pattern damage : {0}", test.FixedPatternDamage));
foreach (string name in test.AdditionalGrades.Keys)
Console.WriteLine(string.Format("{0}: {1}", name.PadRight(40, ' '), test.AdditionalGrades[name]));
if (test.QuietZone != null)
Console.WriteLine(string.Format("Quiet zone : {0} ({1})", test.QuietZone.GradeText, test.QuietZone.ValueText));
Console.WriteLine(string.Format("Distortion angle (informative) : {0}", test.DistortionAngle.ValueText));
Console.WriteLine(string.Format("-------------Scan grade : {0}", test.OverallSymbolGrade));
Console.WriteLine();
}
}
}
}
Imports Vintasoft.Imaging
Imports Vintasoft.Barcode
Imports Vintasoft.Barcode.BarcodeInfo
Imports Vintasoft.Barcode.QualityTests
''' <summary>
''' Test that shows how to test the print quality of matrix 2D barcodes
''' (Aztec, DataMatrix, Han Xin Code, QR and MicroQR).
''' </summary>
Class ISO15415QualityTestMatrixBarcodeExample
''' <summary>
''' Runs the test.
''' </summary>
Public Shared Sub Test(filename As String)
' load image with barcode from file
Using barcodeImage As VintasoftBitmap = ImageCodecs.[Default].Decode(filename)
' read barcodes from image and test the print quality of 2D barcodes
ReadBarcodesAndTestBarcodePrintQuality(barcodeImage)
End Using
End Sub
''' <summary>
''' Reads barcodes from image and tests the print quality of 2D barcodes.
''' </summary>
Public Shared Sub ReadBarcodesAndTestBarcodePrintQuality(imageWithBarcodes As VintasoftBitmap)
' create the barcode reader
Using reader As New BarcodeReader()
' specify that reader must collect information for quality test
reader.Settings.CollectTestInformation = True
' specify that reader must search for Aztec, DataMatrix, Han Xin Code, QR and MicroQR barcodes only
reader.Settings.ScanBarcodeTypes = BarcodeType.Aztec Or BarcodeType.DataMatrix Or BarcodeType.QR Or BarcodeType.MicroQR Or BarcodeType.HanXinCode
' read barcodes
Dim barcodeInfos As IBarcodeInfo() = reader.ReadBarcodes(imageWithBarcodes)
' for each found barcode
For i As Integer = 0 To barcodeInfos.Length - 1
' test print quality of barcode using ISO 15415 test
Dim test As New ISO15415QualityTest()
test.CalculateGrades(DirectCast(barcodeInfos(i), BarcodeInfo2D), imageWithBarcodes)
' print results of ISO 15415 test
Console.WriteLine(String.Format("[{0}] {1}", barcodeInfos(i).BarcodeType, barcodeInfos(i).Value))
Console.WriteLine(String.Format("Decode : {0}", test.Decode))
Console.WriteLine(String.Format("Unused error correction : {0} ({1})", test.UnusedErrorCorrection, test.UnusedErrorCorrection.ValueText))
Console.WriteLine(String.Format("Symbol contrast : {0} ({1})", test.SymbolContrast, test.SymbolContrast.ValueText))
Console.WriteLine(String.Format("Axial nonuniformity : {0} ({1})", test.AxialNonuniformity, test.AxialNonuniformity.ValueText))
Console.WriteLine(String.Format("Grid nonuniformity : {0} ({1})", test.GridNonuniformity, test.GridNonuniformity.ValueText))
Console.WriteLine(String.Format("Modulation : {0}", test.Modulation))
Console.WriteLine(String.Format("Fixed pattern damage : {0}", test.FixedPatternDamage))
For Each name As String In test.AdditionalGrades.Keys
Console.WriteLine(String.Format("{0}: {1}", name.PadRight(40, " "c), test.AdditionalGrades(name)))
Next
If test.QuietZone IsNot Nothing Then
Console.WriteLine(String.Format("Quiet zone : {0} ({1})", test.QuietZone.GradeText, test.QuietZone.ValueText))
End If
Console.WriteLine(String.Format("Distortion angle (informative) : {0}", test.DistortionAngle.ValueText))
Console.WriteLine(String.Format("-------------Scan grade : {0}", test.OverallSymbolGrade))
Console.WriteLine()
Next
End Using
End Sub
End Class
Для тестирования
качества печати двумерных многострочных штрих-кодов с возможностью сканирования по строкам (PDF417, PDF417Compact, MicroPDF417)
, необходимо использовать
ISO15415QualityTest класс.
Алгоритм тестирования основан на ISO/IEC 15415 (третье издание). Тест позволяет оценить качество печати штрих-кода, используя следующие параметры:
- Decode - указывает, успешно ли декодировано значение штрих-кода
- Тест шаблона "ISO15416 Start/RAP (Raw Address Pattern)"
- Тест шаблона "ISO15416 Center (RAP) (MicroPDF417)"
- Тест шаблона "ISO15416 Stop/RAP"
- Unused Error Correction (UEC) - проверяет, насколько региональные или точечные повреждения символа снизили запас безопасности считывания, обеспечиваемый коррекцией ошибок
- Codeword Yield - количество корректно декодированных кодовых слов, выраженное в процентах от максимального количества кодовых слов, которые могли быть декодированы (после корректировки на наклон)
- Качество печати кодовых слов
- Quiet Zone - проверяет тихую зону, для которой требуется спецификация символики штрих-кода
- Distortion Angle - угол искажения (информативный), угол искажения - это величина отклонения от соотношения 90 (градусов) между строкой и столбцом матрицы штрих-кода или осями X и Y
Вот пример C#/VB.NET кода, который демонстрирует проверку качества печати двумерных многострочных штрих-кодов с возможностью сканирования между строками (PDF417, PDF417Compact, MicroPDF417):
using System;
using Vintasoft.Imaging;
using Vintasoft.Barcode;
using Vintasoft.Barcode.BarcodeInfo;
using Vintasoft.Barcode.QualityTests;
/// <summary>
/// Test that shows how to test the print quality of multi-row 2D barcodes
/// (PDF417, PDF417Compact and MicroPDF417).
/// </summary>
class ISO15415QualityTestMultiRowBarcodeExample
{
/// <summary>
/// Runs the test.
/// </summary>
public static void Test()
{
// load image with barcode from file
using (VintasoftBitmap barcodeImage = ImageCodecs.Default.Decode("test1.jpg"))
{
// read barcodes from image and test the print quality of 2D barcodes
ReadBarcodesAndTestBarcodePrintQuality(barcodeImage);
}
}
/// <summary>
/// Reads barcodes from image and tests the print quality of 2D barcodes.
/// </summary>
/// <param name="imageWithBarcodes"></param>
public static void ReadBarcodesAndTestBarcodePrintQuality(VintasoftBitmap imageWithBarcodes)
{
// create the barcode reader
using (BarcodeReader reader = new BarcodeReader())
{
// specify that reader must collect information for quality test
reader.Settings.CollectTestInformation = true;
// specify that reader must search for PDF417, PDF417Compact and MicroPDF417 barcodes only
reader.Settings.ScanBarcodeTypes =
BarcodeType.PDF417 | BarcodeType.PDF417Compact | BarcodeType.MicroPDF417;
// read barcodes
IBarcodeInfo[] barcodeInfos = reader.ReadBarcodes(imageWithBarcodes);
// for each found barcode
for (int i = 0; i < barcodeInfos.Length; i++)
{
// test print quality of barcode using ISO 15415 test
ISO15415QualityTest test = new ISO15415QualityTest();
test.CalculateGrades((BarcodeInfo2D)barcodeInfos[i], imageWithBarcodes);
// print results of ISO 15415 test
Console.WriteLine(string.Format("[{0}] {1}",
barcodeInfos[i].BarcodeType, barcodeInfos[i].Value));
Console.WriteLine(string.Format("Decode : {0}", test.Decode));
Console.WriteLine(string.Format("Unused error correction: {0} ({1})", test.UnusedErrorCorrection, test.UnusedErrorCorrection.ValueText));
if (test.StartPatternTestGrade != null)
Console.WriteLine(string.Format("Start pattern test: {0}", test.StartPatternTestGrade));
if (test.CenterPatternTestGrade != null)
Console.WriteLine(string.Format("Center pattern test: {0}", test.CenterPatternTestGrade));
if (test.CenterPatternTestGrade != null)
Console.WriteLine(string.Format("Stop pattern test: {0}", test.CenterPatternTestGrade));
Console.WriteLine(string.Format("Codeword yield: {0}", test.CodewordYield));
Console.WriteLine(string.Format("Codeword print quality: {0}", test.CodewordPrintQualityGrade));
if (test.QuietZone >= 0)
Console.WriteLine(string.Format("Quiet zone: {0} ({1})", test.QuietZone, test.QuietZone.ValueText));
Console.WriteLine(string.Format("Distortion angle: {0}", test.DistortionAngle.ValueText));
Console.WriteLine(string.Format("-------------Scan grade: {0}", test.OverallSymbolGrade));
Console.WriteLine();
}
}
}
}
Imports Vintasoft.Imaging
Imports Vintasoft.Barcode
Imports Vintasoft.Barcode.BarcodeInfo
Imports Vintasoft.Barcode.QualityTests
''' <summary>
''' Test that shows how to test the print quality of multi-row 2D barcodes
''' (PDF417, PDF417Compact and MicroPDF417).
''' </summary>
Class ISO15415QualityTestMultiRowBarcodeExample
''' <summary>
''' Runs the test.
''' </summary>
Public Shared Sub Test()
' load image with barcode from file
Using barcodeImage As VintasoftBitmap = ImageCodecs.[Default].Decode("test1.jpg")
' read barcodes from image and test the print quality of 2D barcodes
ReadBarcodesAndTestBarcodePrintQuality(barcodeImage)
End Using
End Sub
''' <summary>
''' Reads barcodes from image and tests the print quality of 2D barcodes.
''' </summary>
''' <param name="imageWithBarcodes"></param>
Public Shared Sub ReadBarcodesAndTestBarcodePrintQuality(imageWithBarcodes As VintasoftBitmap)
' create the barcode reader
Using reader As New BarcodeReader()
' specify that reader must collect information for quality test
reader.Settings.CollectTestInformation = True
' specify that reader must search for PDF417, PDF417Compact and MicroPDF417 barcodes only
reader.Settings.ScanBarcodeTypes = BarcodeType.PDF417 Or BarcodeType.PDF417Compact Or BarcodeType.MicroPDF417
' read barcodes
Dim barcodeInfos As IBarcodeInfo() = reader.ReadBarcodes(imageWithBarcodes)
' for each found barcode
For i As Integer = 0 To barcodeInfos.Length - 1
' test print quality of barcode using ISO 15415 test
Dim test As New ISO15415QualityTest()
test.CalculateGrades(DirectCast(barcodeInfos(i), BarcodeInfo2D), imageWithBarcodes)
' print results of ISO 15415 test
Console.WriteLine(String.Format("[{0}] {1}", barcodeInfos(i).BarcodeType, barcodeInfos(i).Value))
Console.WriteLine(String.Format("Decode : {0}", test.Decode))
Console.WriteLine(String.Format("Unused error correction: {0} ({1})", test.UnusedErrorCorrection, test.UnusedErrorCorrection.ValueText))
If test.StartPatternTestGrade IsNot Nothing Then
Console.WriteLine(String.Format("Start pattern test: {0}", test.StartPatternTestGrade))
End If
If test.CenterPatternTestGrade IsNot Nothing Then
Console.WriteLine(String.Format("Center pattern test: {0}", test.CenterPatternTestGrade))
End If
If test.CenterPatternTestGrade IsNot Nothing Then
Console.WriteLine(String.Format("Stop pattern test: {0}", test.CenterPatternTestGrade))
End If
Console.WriteLine(String.Format("Codeword yield: {0}", test.CodewordYield))
Console.WriteLine(String.Format("Codeword print quality: {0}", test.CodewordPrintQualityGrade))
If test.QuietZone IsNot Nothing Then
Console.WriteLine(String.Format("Quiet zone: {0} ({1})", test.QuietZone, test.QuietZone.ValueText))
End If
Console.WriteLine(String.Format("Distortion angle: {0}", test.DistortionAngle.ValueText))
Console.WriteLine(String.Format("-------------Scan grade: {0}", test.OverallSymbolGrade))
Console.WriteLine()
Next
End Using
End Sub
End Class