VintaSoft Barcode .NET SDK v10.0
ISO15415QualityTest Class
Members  Example 




Vintasoft.Barcode.QualityTests Namespace : ISO15415QualityTest Class
ISO/IEC 15415 barcode print quality test for 2D barcodes.
Object Model
ISO15415QualityTest ClassISO15416QualityTest ClassISO15416QualityTest ClassISO15416QualityTest ClassISO15416QualityTest Class
Syntax
'Declaration
 
Public Class ISO15415QualityTest 
'Usage
 
Dim instance As ISO15415QualityTest
public class ISO15415QualityTest 
public __gc class ISO15415QualityTest 
public ref class ISO15415QualityTest 
Remarks
Test can be used for testing the print quality of 2D matrix barcodes (Aztec, DataMatrix, QR Code, Micro QR Code). The algorithm of test is based on ISO/IEC 15415. 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 and MicroQR) and multi-row 2D barcodes (PDF417, PDF417Compact and MicroPDF417):
Imports System.Drawing   
   
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, QR and MicroQR).   
''' </summary>   
Class ISO15415QualityTestMatrixExample   
   
	''' <summary>   
	''' Runs the test.   
	''' </summary>   
	Public Shared Sub Test()   
		' load image with barcode from file   
		Using barcodeImage As Image = Image.FromFile("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>   
	Public Shared Sub ReadBarcodesAndTestBarcodePrintQuality(imageWithBarcodes As Image)   
		' 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(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}", GradeToString(test.DecodeGrade)))   
				Console.WriteLine(String.Format("Unused error correction                 : {0} ({1}%)", GradeToString(test.UnusedErrorCorrectionGrade), test.UnusedErrorCorrection))   
				Console.WriteLine(String.Format("Symbol contrast                         : {0} ({1}%)", GradeToString(test.SymbolContrastGrade), test.SymbolContrast))   
				Console.WriteLine(String.Format("Axial nonuniformity                     : {0} ({1})", GradeToString(test.AxialNonuniformityGrade), test.AxialNonuniformity))   
				Console.WriteLine(String.Format("Grid nonuniformity                      : {0} ({1} cell)", GradeToString(test.GridNonuniformityGrade), test.GridNonuniformity))   
				Console.WriteLine(String.Format("Modulation                              : {0}", GradeToString(test.ModulationGrade)))   
				Console.WriteLine(String.Format("Reflectance margin                      : {0}", GradeToString(test.ReflectanceMarginGrade)))   
				Console.WriteLine(String.Format("Fixed pattern damage                    : {0}", GradeToString(test.FixedPatternDamageGrade)))   
				For Each name As String In test.AdditionalGrades.Keys   
					Console.WriteLine(String.Format("{0}: {1}", name.PadRight(40, " "C), GradeToString(test.AdditionalGrades(name))))   
				Next   
				If test.QuietZone >= 0 Then   
					Console.WriteLine(String.Format("Quiet zone                              : {0} ({1} %)", GradeToString(test.QuietZoneGrade), test.QuietZone))   
				End If   
				Console.WriteLine(String.Format("Distortion angle (informative)          : {0}°", test.DistortionAngle))   
				Console.WriteLine(String.Format("-------------Scan grade                 : {0}", GradeToString(test.ScanGrade)))   
				Console.WriteLine()   
			Next   
		End Using   
	End Sub   
   
	''' <summary>   
	''' Converts ISO15415 quality grade into string value.   
	''' </summary>   
	Private Shared Function GradeToString(grade As ISO15415QualityGrade) As String   
		Return String.Format("{0}({1})", CInt(grade).ToString(), grade)   
	End Function   
   
End Class
Imports System.Drawing   
   
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 Image = Image.FromFile("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 Image)   
		' 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(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}", GradeToString(test.DecodeGrade)))   
				Console.WriteLine(String.Format("Unused error correction: {0} ({1}%)", GradeToString(test.UnusedErrorCorrectionGrade), test.UnusedErrorCorrection))   
				If test.StartPatternTestGrade <> ISO15415QualityGrade.Unavailable Then   
					Console.WriteLine(String.Format("Start pattern test:      {0}", GradeToString(test.StartPatternTestGrade), test.StartPatternTestGrade))   
				End If   
				If test.CenterPatternTestGrade <> ISO15415QualityGrade.Unavailable Then   
					Console.WriteLine(String.Format("Center pattern test:     {0}", GradeToString(test.CenterPatternTestGrade), test.CenterPatternTest))   
				End If   
				If test.CenterPatternTestGrade <> ISO15415QualityGrade.Unavailable Then   
					Console.WriteLine(String.Format("Stop pattern test:       {0}", GradeToString(test.CenterPatternTestGrade), test.CenterPatternTestGrade))   
				End If   
				Console.WriteLine(String.Format("Codeword yield:          {0}", GradeToString(test.CodewordYieldGrade), test.CodewordYieldGrade))   
				Console.WriteLine(String.Format("Codeword print quality:  {0}", GradeToString(test.CodewordPrintQualityGrade), test.CodewordPrintQualityGrade))   
				If test.QuietZone >= 0 Then   
					Console.WriteLine(String.Format("Quiet zone:              {0} ({1} %)", GradeToString(test.QuietZoneGrade), test.QuietZone))   
				End If   
				Console.WriteLine(String.Format("Distortion angle:        {0}°", test.DistortionAngle))   
				Console.WriteLine(String.Format("-------------Scan grade: {0}", GradeToString(test.ScanGrade)))   
				Console.WriteLine()   
			Next   
		End Using   
	End Sub   
   
	''' <summary>   
	''' Converts ISO15415 quality grade into string value.   
	''' </summary>   
	Private Shared Function GradeToString(grade As ISO15415QualityGrade) As String   
		Return String.Format("{0}({1})", CInt(grade).ToString(), grade)   
	End Function   
   
End Class
using System;
using System.Drawing;
            
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, QR and MicroQR).
/// </summary>
class ISO15415QualityTestMatrixExample
{
            
    /// <summary>
    /// Runs the test.
    /// </summary>
    public static void Test()
    {
        // load image with barcode from file
        using (Image barcodeImage = Image.FromFile("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>
    public static void ReadBarcodesAndTestBarcodePrintQuality(Image 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((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}",
                    GradeToString(test.DecodeGrade)));
                Console.WriteLine(string.Format("Unused error correction                 : {0} ({1}%)",
                    GradeToString(test.UnusedErrorCorrectionGrade), test.UnusedErrorCorrection));
                Console.WriteLine(string.Format("Symbol contrast                         : {0} ({1}%)",
                    GradeToString(test.SymbolContrastGrade), test.SymbolContrast));
                Console.WriteLine(string.Format("Axial nonuniformity                     : {0} ({1})",
                    GradeToString(test.AxialNonuniformityGrade), test.AxialNonuniformity));
                Console.WriteLine(string.Format("Grid nonuniformity                      : {0} ({1} cell)",
                    GradeToString(test.GridNonuniformityGrade), test.GridNonuniformity));
                Console.WriteLine(string.Format("Modulation                              : {0}",
                    GradeToString(test.ModulationGrade)));
                Console.WriteLine(string.Format("Reflectance margin                      : {0}",
                    GradeToString(test.ReflectanceMarginGrade)));
                Console.WriteLine(string.Format("Fixed pattern damage                    : {0}",
                    GradeToString(test.FixedPatternDamageGrade)));
                foreach (string name in test.AdditionalGrades.Keys)
                    Console.WriteLine(string.Format("{0}: {1}",
                        name.PadRight(40, ' '), GradeToString(test.AdditionalGrades[name])));
                if (test.QuietZone >= 0)
                    Console.WriteLine(string.Format("Quiet zone                              : {0} ({1} %)",
                        GradeToString(test.QuietZoneGrade), test.QuietZone));
                Console.WriteLine(string.Format("Distortion angle (informative)          : {0}°",
                    test.DistortionAngle));
                Console.WriteLine(string.Format("-------------Scan grade                 : {0}",
                    GradeToString(test.ScanGrade)));
                Console.WriteLine();
            }
        }
    }
            
    /// <summary>
    /// Converts ISO15415 quality grade into string value.
    /// </summary>
    static string GradeToString(ISO15415QualityGrade grade)
    {
        return string.Format("{0}({1})", ((int)grade).ToString(), grade);
    }
            
}
using System;
using System.Drawing;
            
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 (Image barcodeImage = Image.FromFile("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(Image 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((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}",
                    GradeToString(test.DecodeGrade)));
                Console.WriteLine(string.Format("Unused error correction: {0} ({1}%)",
                    GradeToString(test.UnusedErrorCorrectionGrade), test.UnusedErrorCorrection));
                if (test.StartPatternTestGrade != ISO15415QualityGrade.Unavailable)
                    Console.WriteLine(string.Format("Start pattern test:      {0}",
                        GradeToString(test.StartPatternTestGrade), test.StartPatternTestGrade));
                if (test.CenterPatternTestGrade != ISO15415QualityGrade.Unavailable)
                    Console.WriteLine(string.Format("Center pattern test:     {0}",
                        GradeToString(test.CenterPatternTestGrade), test.CenterPatternTest));
                if (test.CenterPatternTestGrade != ISO15415QualityGrade.Unavailable)
                    Console.WriteLine(string.Format("Stop pattern test:       {0}",
                        GradeToString(test.CenterPatternTestGrade), test.CenterPatternTestGrade));
                Console.WriteLine(string.Format("Codeword yield:          {0}",
                    GradeToString(test.CodewordYieldGrade), test.CodewordYieldGrade));
                Console.WriteLine(string.Format("Codeword print quality:  {0}",
                    GradeToString(test.CodewordPrintQualityGrade), test.CodewordPrintQualityGrade));
                if (test.QuietZone >= 0)
                    Console.WriteLine(string.Format("Quiet zone:              {0} ({1} %)",
                        GradeToString(test.QuietZoneGrade), test.QuietZone));
                Console.WriteLine(string.Format("Distortion angle:        {0}°",
                    test.DistortionAngle));
                Console.WriteLine(string.Format("-------------Scan grade: {0}",
                    GradeToString(test.ScanGrade)));
                Console.WriteLine();
            }
        }
    }
            
    /// <summary>
    /// Converts ISO15415 quality grade into string value.
    /// </summary>
    static string GradeToString(ISO15415QualityGrade grade)
    {
        return string.Format("{0}({1})", ((int)grade).ToString(), grade);
    }
            
}
Inheritance Hierarchy

System.Object
   Vintasoft.Barcode.QualityTests.ISO15415QualityTest

Requirements

Target Platforms: Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

See Also

Reference

ISO15415QualityTest Members
Vintasoft.Barcode.QualityTests Namespace