Dev Center
Table of contents

How to Read Barcodes with Small Module Size

A module is the narrowest “bar” in a 1D barcode, or the smallest “box” in a 2D barcode. Keep in mind this “bar” or “box” can be either light or dark. The figure below illustrates the module size of 1D and 2D barcodes.

Module size of barcodes

Figure 1 – Module size of 1D and 2D barcodes

In some scenarios, the barcode is very small relative to the entire image, and its module size is even smaller, making it difficult for the library to read the barcode. In this case, we can use the parameter ScaleUpModes in to enlarge the barcode symbol for easier processing.

Particular Parameter Required

Dynamsoft Barcode Reader (DBR) provides a parameter ScaleUpModes that allows you to control the scale-up process when targets in the image are too small.

Sample Code

Below is an example illustrating how to configure the parameter ScaleUpModes.

  • update parameter ScaleUpModes in your JSON template

      {
          "CaptureVisionTemplates": [
              {
                  "Name": "CV_0",
                  "ImageROIProcessingNameArray": ["TA_0" ]
              }       
          ],
          "TargetROIDefOptions" : [
              {
                  "Name": "TA_0",
                  "TaskSettingNameArray": [ "BR_0" ]
              }
          ],
          "BarcodeReaderTaskSettingOptions": [
              {
                  "Name" : "BR_0",
                  "SectionImageParameterArray": [
                      {
                          "Section": "ST_REGION_PREDETECTION",
                          "ImageParameterName": "IP_0"
                      },
                      {
                          "Section": "ST_BARCODE_LOCALIZATION",
                          "ImageParameterName": "IP_0"
                      },
                      {
                          "Section": "ST_BARCODE_DECODING",
                          "ImageParameterName": "IP_0"
                      }
                  ]
              }
          ],
          "ImageParameterOptions": [
              {
                  "Name": "IP_0",
                  "ScaleUpModes": [
                      {
                          "Mode": "SUM_LINEAR_INTERPOLATION",
                          "AcuteAngleWithXThreshold": 0,
                          "ModuleSizeThreshold": 3,
                          "TargetModuleSize": 8
                      }
                  ]
              }
          ]
      }
    
  • apply settings by calling method InitSettingsFromFile

  • JavaScript
  • C++
  • Android
  • Objective-C
  • Swift
// `router` is an instance of `CaptureVisionRouter`.
// In the JS edition, the method name we use for initialization is different.
router.initSettings("PATH-TO-YOUR-SETTING")
char szErrorMsg[256] = {0};
CCaptureVisionRouter* cvr = new CCaptureVisionRouter;
cvr->InitSettingsFromFile("PATH-TO-YOUR-SETTING-FILE", szErrorMsg, 256);
// more process here
try {
   // `cvr` is an instance of `CaptureVisionRouter`.
   cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE");
} catch (CaptureVisionRouterException e) {
   e.printStackTrace();
}
NSError *error;
// `cvr` is an instance of `DSCaptureVisionRouter`.
[self.cvr initSettingsFromFile:@"PATH-TO-YOUR-SETTING-FILE" error:&error];
do{
   //`cvr` is an instance of `CaptureVisionRouter`.
   try cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE")
}catch{
   // Add code to do when error occurs.
}

This page is compatible for:

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
  • Documentation Homepage
Change +