AdditionalGrades Свойство (ISO15415QualityTest)
В этом разделе
Возвращает дополнительные оценки, которые зависят от символики штрих-кода.
Синтаксис
Ремарки
Дополнительные оценки для штрих-кода 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.
Сегмент L1 представляет собой вертикальную часть L и простирается до модуля в тихой зоне, примыкающей к л угол. Сегмент L2 представляет собой горизонтальную часть L и простирается до модуля в тихой зоне, примыкающей к углу L. Сегменты QZL1 и QZL2 представляют собой части тихой зоны, примыкающие к L1 и L2 соответственно, и простираются на один модуль за конец L1 и L2 соответственно, дальше всего от угла.
Дополнительные оценки для штрих-кода Han Xin Code Matrix (определены в спецификации):
- FixedPatternDamage.A1 - оценка 11 x 11 в левом верхнем углу символа (шаблон поиска и тихий zone).
- FixedPatternDamage.A2 - оценка 11 x 11 в правом верхнем углу символа (шаблон поиска и тихая зона).
- FixedPatternDamage.A3 - оценка 11 x 11 в правом нижнем углу символа (шаблон поиска и тихая зона).
- FixedPatternDamage.A4 - оценка 11 x 11 в левом нижнем углу символа (шаблон поиска). и тихая зона).
- FixedPatternDamage.B - степень шаблона выравнивания и шаблона выравнивания помощника.
- StructuralInformationRegion.Region1 - Уровень области структурной информации 1 (слева вверху и справа вверху).
- StructuralInformationRegion.Region2 - уровень области структурной информации 1 (слева внизу и справа внизу).
- StructuralInformationRegion.Region - уровень структурной информации, регион 1 и регион 2.
Пример
Вот С#/VB.NET код, демонстрирующий, как проверить качество печати матричных 2D-штрих-кодов (Aztec, DataMatrix, QR и MicroQR):
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 ISO15415QualityTestMatrixExample
''' <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
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 ISO15415QualityTestMatrixExample
{
/// <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();
}
}
}
}
Требования
Целевые платформы: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5
Смотрите также