Table of contents

BarcodeScaleModes

Parameter BarcodeScaleModes defines the scaling mode applied during barcode recognition.

Example

{
    "BarcodeScaleModes": 
    [
        {
            "Mode": "BSM_LINEAR_INTERPOLATION", 
            "ModuleSizeThreshold": 4,
            "TargetModuleSize": 8,
            "AcuteAngleWithXThreshold": -1
        },
    ]
}

Parameter Summary

Parameter BarcodeScaleModes consist of a group of scale mode objects. Each scale mode object includes a candidate mode and a series of mode arguments. The mode arguments of the scale mode object is shown as follow:

Mode Arguments

Mode Argument Name Mode Argument Summary
Mode
(Required)
Description
Any one in Candidate Mode List as string
Type
String
Candidate Mode List
BSM_LINEAR_INTERPOLATION
Default Value

BSM_LINEAR_INTERPOLATION
AcuteAngleWithXThreshold
(Optional)
Description
Sets the acute angle threshold for barcode image scale.
-1: means automatically set by the library.
The barcode image scaling operation can be performed only if the acute angle between the barcode and the X-axis is greater than the value of AcuteAngleWithXThreshold.
Type
int
Range
[-1, 90]
Default Value
-1
ModuleSizeThreshold
(Optional)
Description
Sets the module size threshold for barcode image scale.
0: means automatically set by the library.
The scaling logic is as follows:
1. If ModuleSizeThreshold < TargetModuleSize, the scale-up logic is applied. If the module size of the barcode is smaller than the ModuleSizeThreshold, the barcode image will be enlarged by a scale factor of N (the value of N is a power of 2) till N * modulesize >= TargetModuleSize.
2. If ModuleSizeThreshold > TargetModuleSize, the scale-down logic is applied. If the module size of the barcode is larger than the ModuleSizeThreshold, the barcode image will be shrinked by a scale factor of N (the value of N is a power of 2) till N * modulesize <= TargetModuleSize.
If ModuleSizeThreshold = TargetModuleSize, the scaling operation is ignored.
Type
int
Range
[0, 0x7fffffff]
Default Value
0
TargetModuleSize
(Optional)
Description
Sets the module size threshold for barcode image scale.
0: means automatically set by the library.
The scaling logic is as follows:
1. If ModuleSizeThreshold < TargetModuleSize, the scale-up logic is applied. If the module size of the barcode is smaller than the ModuleSizeThreshold, the barcode image will be enlarged by a scale factor of N (the value of N is a power of 2) till N * modulesize >= TargetModuleSize.
2. If ModuleSizeThreshold > TargetModuleSize, the scale-down logic is applied. If the module size of the barcode is larger than the ModuleSizeThreshold, the barcode image will be shrinked by a scale factor of N (the value of N is a power of 2) till N * modulesize <= TargetModuleSize.
If ModuleSizeThreshold = TargetModuleSize, the scaling operation is ignored.
Type
int
Range
[0, 0x7fffffff]
Default Value
0

Default Setting

If the BarcodeScaleModes is not configured in your template file, the following setting will be used as the default setting.

{
    "BarcodeScaleModes" : 
    [
        {
            "Mode" : "BSM_LINEAR_INTERPOLATION",
            "ModuleSizeThreshold" : 0,
            "TargetModuleSize" : 0,
            "AcuteAngleWithXThreshold" : -1
        }
    ]
}

Candidate Modes Introduction

BSM_LINEAR_INTERPOLATION

Scales image using the linear interpolation method. This mode has the following arguments for further customizing:

  • AcuteAngleWithXThreshold
  • ModuleSizeThreshold
  • TargetModuleSize

Is this page helpful?

YesYes NoNo