Check Barcode Recognition Quality


In many cases, it is necessary to estimate whether the barcode has been recognized accurately. In Aspose.BarCode for .NET, this can be done using two specific properties of class BarCodeResult: Confidence and ReadingQuality.

Verify Barcode Reading Quality

As a result of barcode reading, the Confidence property returns a value from the BarCodeConfidence enumeration that corresponds to the recognition confidence level. Possible values of the BarCodeConfidence enumeration (None, Moderate, and Strong) are explained in the table below. The ReadingQuality parameter returns the estimate of recognition quality according to the identified confidence level: 0 for None; from 1 to 99; 100 for Strong.

Confidence Level Reading Quality Value Description
None 0 If the confidence level returns None, it usually means that the source barcode is incorrect and its input data has been decoded with errors. However, it is still possible to get its type and place orientation in the source image, as well as partially decode inputted data
Moderate 80 Is returned for 1D and postal barcodes with weak or missing checksum settings. In this case, it is required to analyze the value of ReadingQuality; however, even in the case of high values (close to 80), the absolute correctness of barcode recognition is not guaranteed
Strong 100 Is returned for all 2D barcode types with Reed-Solomon error correction in case the quality setting has not been set to QualitySettings.AllowIncorrectBarcodes. When this confidence level is returned, it means that barcode text has been decoded correctly, and the recognition process has been completed successfully

The following code snippet explains how to get the recognition quality estimate for a sample barcode image.

//recognize image
using (BarCodeReader read = new BarCodeReader($"{path}qr_code128.png", DecodeType.QR, DecodeType.Code128))
    foreach (BarCodeResult result in read.ReadBarCodes())