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 set the barcode format and the number of barcodes expected to be detected

DBR can handle various common barcode formats on the market and is well suited to supporting multi-code scenes on an image. In order to support all barcode formats and solve all codes appearing in the figure, it will consume a certain amount of time. If you don’t want to consume extra time, you can set the required barcode format through BarcodeFormatIds, BarcodeFormatIds_2, and set the number of barcodes expected to be detected through ExpectedBarcodesCount.

BarcodeFormatIds,BarcodeFormatIds_2

These two parameters are used to set the required barcode format to be decoded. Barcode formats not specified will not be processed. You can speed up DBR processing by eliminating barcode formats that you don’t care about. For specific enumeration values for the parameters, please refer to our API documents BarcodeFormatIds, BarcodeFormatIds_2.

ExpectedBarcodesCount

This parameter is used to set the number of barcodes expected to be detected for each image. When the number of detected barcodes is greater than or equal to this parameter, the DBR algorithm will terminate. DBR can handle scenes with multiple barcodes in one image. Using this setting to specify the expected number of barcodes to read you can save time once the expected number of reads have occurred.

Example

The following demonstrates the two configuration methods of RuntimeSetting and JSON template

CBarcodeReader* reader = new CBarcodeReader();   
reader->InitLicense("enter your license");  
PublicRuntimeSettings* runtimeSettings = new PublicRuntimeSettings();   
reader->GetRuntimeSettings(runtimeSettings); //get runtime settings 
runtimeSettings->barcodeFormatIds = BF_ALL; //set barcode format. BF_ALL means all barcode formats   
runtimeSettings->barcodeFormatIds_2 = BF2_NULL; //set barcode format2   
runtimeSettings->expectedBarcodesCount = 1; //set the number of barcodes expected to be detected to 1  
char sError[512];   
reader->UpdateRuntimeSettings(runtimeSettings, sError, 512); //update runtime settings 
reader->DecodeFile("file path", ""); //decode  
TextResultArray* paryResult = NULL;   
reader->GetAllTextResults(&paryResult); //get decode result 
dynamsoft::dbr::CBarcodeReader::FreeTextResults(&paryResult);   
delete runtimeSettings;   
delete reader;  
{    
    "Version":"3.0",    
    "ImageParameter":    
    {    
        "Name":"IP1",    
        "BarcodeFormatIds":["BF_ALL"],
        "BarcodeFormatIds_2":["BF2_NULL"],        
        "ExpectedBarcodesCount":1
    }    
}   

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

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 +