Dev Center
Table of contents

Thanks for downloading Dynamsoft Barcode Reader Package!

Your download will start shortly. If your download does not begin, click here to retry.

How to Decode Incomplete Barcodes

In some cases, barcodes may have incomplete parts due to misprinting. For example, a QR code that is missing the position detection pattern (See the sample image below). In this case, you can enable the barcode completion logic in Dynamsoft Barcode Reader(DBR) by turning on BarcodeComplementModes. DBR will then automatically attempt to complete and correct the location information that is incorrect or lost due to misprinting according to the structure characteristics of the corresponding barcode type. The barcode completion logic only supports QR code and Data Matrix at present. BarcodeComplementModes is disabled by default, you can enable it based on your requirements.

Here are two examples with imcomplete barcodes barcode-complememt-modes-sample-image-dm barcode-complememt-modes-sample-image-qr

Sample code snippets

Enable BarcodeComplementModes

CBarcodeReader* reader = new CBarcodeReader(); 
reader->InitLicense("Input your license"); 
PublicRuntimeSettings* runtimeSettings = new PublicRuntimeSettings(); 
reader->GetRuntimeSettings(runtimeSettings); //Get current settings 
runtimeSettings->furtherModes.barcodeComplementModes[0] = BCM_GENERAL; //Enable barcode completion logic 
char sError[512]; 
reader->UpdateRuntimeSettings(runtimeSettings, sError, 512); 
reader->DecodeFile("Path to your image file", ""); //Decode image 
TextResultArray* paryResult = NULL; 
reader->GetAllTextResults(&paryResult); //Get results 
int iCount = paryResult->resultsCount; 
for (int i = 0; i < iCount; i++) 
{ 
    printf("Text: %s", paryResult->results[i]->barcodeText); //print results 
} 
dynamsoft::dbr::CBarcodeReader::FreeTextResults(&paryResult); 
delete runtimeSettings; 
delete reader; 

JSON template

{
    "Version":"3.0",
    "ImageParameterContentArray": 
    [
        {
            "Name":"Test1",
            "FormatSpecificationNameArray":["FP_1"],
            "ExpectedBarcodesCount":0,
            "MaxAlgorithmThreadCount":4,
            "BarcodeFormatIds":["BF_ALL"],
            "BarcodeComplementModes":["BCM_GENERAL"],
            "DeblurLevel":9
        }
    ],
    "FormatSpecificationArray":
    [
        {
            "Name":"FP_1",
            "BarcodeFormatIds":["BF_PDF417","BF_QR_CODE","BF_DATAMATRIX"],
            "MirrorMode":"MM_Both"
        }
    ]
}

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest version
  • Version 10.x
    • Version 10.2.0
    • Version 10.0.21
    • Version 10.0.20
    • Version 10.0.10
    • Version 10.0.0
  • Version 9.x
    • Version 9.6.42
    • Version 9.6.40
    • Version 9.6.33
    • Version 9.6.32
    • Version 9.6.31
    • Version 9.6.30
    • Version 9.6.20
    • Version 9.6.10
    • Version 9.6.0
    • Version 9.4.0
    • Version 9.2.0
    • Version 9.0.0
  • Version 8.x
    • Version 8.8.0
    • Version 8.6.0
    • Version 8.4.0
    • Version 8.2.0
    • Version 8.1.2
    • Version 8.1.0
    • Version 8.0.0
  • Version 7.x
    • Version 7.6.0
    • Version 7.5.0
Change +