VintaSoft Barcode .NET SDK 16.0: Documentation for .NET developer
Vintasoft.Barcode.QualityTests Namespace / ISO15415QualityTest Class
Members Object Syntax Remarks Example Hierarchy Requirements SeeAlso
In This Topic
ISO15415QualityTest Class
In This Topic
ISO/IEC 15415:2024 barcode print quality test for 2D barcodes.
Object Model
BarcodeInfo2D QualityTestAssessmentParameter QualityTestAssessmentParameter QualityTestAssessmentParameter QualityTestAssessmentParameter QualityTestAssessmentParameter QualityTestAssessmentParameter QualityTestAssessmentParameter QualityTestAssessmentParameter QualityTestAssessmentParameter QualityTestAssessmentParameter QualityTestAssessmentParameter QualityTestAssessmentParameter QualityTestAssessmentParameter QualityTestAssessmentParameter QualityTestPassFailParameter QualityTestPercentParameter QualityTestPercentParameter QualityTestPercentParameter QualityTestPercentParameter QualityTestPercentParameter QualityTestPercentParameter QualityTestPercentParameter ISO15416QualityTest ISO15416QualityTest ISO15416QualityTest ISO15416QualityTest QualityTestAngleParameter ISO15415QualityTest
Syntax
'Declaration

Public Class ISO15415QualityTest

public class ISO15415QualityTest

Remarks

We recomend to use the QualityTestManager class to perform print quality testing of 2D barcodes.
Test can be used for testing the print quality of 2D matrix barcodes (Aztec, DataMatrix, QR Code, Micro QR Code, Han Xin Code). The algorithm of test is based on ISO/IEC 15415:2024 (Third edition). Test allows to evaluate the barcode's print quality using the following parameters:


Also test can be used for testing the print quality of 2D multi-row barcodes with cross-row scanning ability (PDF417, PDF417Compact, MicroPDF417). The algorithm of test is based on ISO/IEC 15415. Test allows to evaluate the barcode's print quality using the following parameters:

Example

Here is an example that demonstrates how to test print quality of matrix 2D barcodes (Aztec, DataMatrix, QR, MicroQR and Han Xin Code) and multi-row 2D barcodes (PDF417, PDF417Compact and MicroPDF417):

   
   
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 ISO15415QualityTestMultiRowExample   
   
    ''' <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


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 ISO15415QualityTestMultiRowExample
{

    /// <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();
            }
        }
    }
}

Inheritance Hierarchy

System.Object
   Vintasoft.Barcode.QualityTests.ISO15415QualityTest

Requirements

Target Platforms: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

See Also