Thanks for downloading Dynamsoft Barcode Reader Package!
Your download will start shortly. If your download does not begin, click here to retry.
This article introduces the parameter definitions, organization structure, usage rules, and related interfaces involved in Dynamsoft Barcode Reader.
Dynamsoft Barcode Reader uses a template to set parameters. A template contains three types of data: ImageParameter
, RegionDefinition
, and FormatSpecification
.
ImageParameter
is used to specify the decoding settings on the entire image. The value of the ImageParameter.Name
field is the unique identifier of the ImageParameter
.RegionDefinition
is used to specify a decoding region. It is also used to specify the decoding settings in this area. The value of the RegionDefinition.Name
field is the unique identifier of RegionDefinition
.FormatSpecification
is used to specify a barcode format. It is also used to specify the decoding settings of this barcode format. The value of the FormatSpecification.Name
field is the unique identifier of FormatSpecification
.ImageParameter
in a template definition. The ImageParameter.Name
field denotes the unique identifier of the template;RegionDefinition
can be referenced through RegionDefinitionNameArray
in ImageParameter
;FormatSpecification
can be referenced through FormatSpecificationNameArray
in ImageParameter
;FormatSpecification
can be referenced through FormatSpecificationNameArray
in RegionDefinition
;ImageParameterContentArray
/RegionDefinitionArray
/FormatSpecificationArray
field to define multiple ImageParameter
/RegionDefinition
/FormatSpecification
, for example:{
"FormatSpecificationArray": [{
"Name": "IP1_BF_QR_CODE"
}],
"ImageParameter": {
"FormatSpecificationNameArray": [
"IP1_BF_QR_CODE"
],
"Name": "default",
"RegionDefinitionNameArray": [
"region1"
]
},
"RegionDefinition": {
"Name": "region1"
},
"Version": "3.0"
}
When the same parameter is set in both ImageParameter
and RegionDefinition
, the decoding operation in the region specified by RegionDefinition
is used; otherwise, the parameter values under the ImageParameter
will be used.
When the same parameter is set in both ImageParameter
and FormatSpecification
, the decoding operation for the barcode format specified by FormatSpecification
is used; otherwise, the parameter values under the ImageParameter
will be used.
When the same parameter is set in both RegionDefinition
and FormatSpecification
, the decoding operation for the barcode format specified by FormatSpecification
is used in the region specified by RegionDefinition
; otherwise, the parameter values under the ImageParameter
will be used.
The parameters of ImageParameter
are:
The parameters of RegionDefinition
are:
The parameters of FormatSpecification
are:
When setting parameters through a JSON template, Dynamsoft Barcode Reader will process the template according to the following rules:
ImageParameter
/RegionDefinition
/FormatSpecification
will be filled with default valuesFormatSpecification
is automatically split into multiple settings for a single barcode format, for example:Template you set
{
"ImageParameter":{
"Name": "ImageParameter1",
"BarcodeFormatIds": ["BF_ONED"],
"FormatSpecificationNameArray": [
"FormatSpecification1"
]
},
"FormatSpecification": {
"Name": "FormatSpecification1",
"BarcodeFormatIds": ["BF_CODE_39","BF_CODE_128"],
"MinResultConfidence": 20
}
}
Template used by DBR
{
"ImageParameter":{
"Name": "ImageParameter1",
"BarcodeFormatIds": ["BF_ONED"],
"FormatSpecificationNameArray": [
"FormatSpecification1_BF_CODE_39",
"FormatSpecification1_BF_CODE_128"
]
},
"FormatSpecificationArray":[
{
"Name": "FormatSpecification1_BF_CODE_39",
"BarcodeFormatIds": ["BF_CODE_39"],
"MinResultConfidence": 20
},
{
"Name": "FormatSpecification1_BF_CODE_128",
"BarcodeFormatIds": ["BF_CODE_128"],
"MinResultConfidence": 20
}
]
}
When the two templates are merged, duplicate parameter settings in the defined ImageParameter
are handled as follows:
ConflictMode
. If ConflictMode
is IGNORE
, the first value is taken. If ConflictMode
is OVERWRITE
, the last value is taken
The entire decoding process of Dynamsoft Barcode Reader consists of many subdivided functions, among which the control parameters of some function blocks are designed in accordance with the format of Modes-Mode-Argument. That is, a function is controlled by a Modes parameter. There are many ways to implement this function, each method (Mode) has multiple unique settings, and each setting is an Argument.
For example, one of the functions in the decoding process is barcode localization. Dynamsoft Barcode Reader provides the LocalizationModes
parameter to control this function. It provides LM_CONNECTED_BLOCKS
, LM_STATISTICS
, LM_LINES
, LM_SCAN_DIRECTLY
, LM_STATISTICS_MARKS
, LM_STATISTICS_POSTAL_CODE
, a total of 6 methods to implement barcode localization. For LM_SCAN_DIRECTLY, there are two Arguments, ScanStride
and ScanDirection
.
Dynamsoft Barcode Reader provides two ways to set parameters: PublicRuntimeSettings
and JSON template files.
PublicRuntimeSettings
is used to modify the Dynamsoft Barcode Reader built-in template, and only supports commonly used parameters. The following are the steps to update Dynamsoft Barcode Reader parameters through PublicRuntimeSettings
:
ResetRuntimeSettings
interfaceGetRuntimeSettings
interface to get the current PublicRuntimeSettings
of the Dynamsoft Barcode Reader objectPublicRuntimeSettings
in the previous stepUpdateRuntimeSettings
interface to apply the modified PublicRuntimeSettings
in the previous step to the Dynamsoft Barcode Reader objectSetModeArgument
interface to set the optional argument for a specified mode in Modes parameters.JSON templates supports all Dynamsoft Barcode Reader parameters. The related parameter setting interfaces are:
InitRuntimeSettingsWithFile
: After calling this interface, the template definition in the file are processed according to the merging rules stated in the “Multiple parameter template files” section. Each independent template is stored in the Dynamsoft Barcode Reader object. All templates are merged into one template, then replace the built-in template of Dynamsoft Barcode Reader;InitRuntimeSettingsWithString
: The effect after calling this interface is the same as InitRuntimeSettingsWithFile
. The only difference is the template definition of InitRuntimeSettingsWithString
is saved as a string;AppendTplFileToRuntimeSettings
: After calling this interface, the template definition in the file will be processed according to the merging rules stated in the “Multiple parameter template files” section . Each independent template is stored in the Dynamsoft Barcode Reader object. All templates, including Dynamsoft Barcode Reader’s built-in template, are merged into one template to replace the built-in template of Dynamsoft Barcode Reader;AppendTplStringToRuntimeSettings
: The effect after calling this interface is the same as AppendTplFileToRuntimeSettings
. The only difference is the template definition of AppendTplStringToRuntimeSettings
is saved as a string.Limiting the reading area of the barcode reader instance can help provide a better scanning UI as well optimize the performance of the SDK. It is important to understand how the RegionDefinition interface works, and what exactly you need to consider when coming up with the region percentage values.
By definition, the top
parameter of the RegionDefinition is used to represent the top-most coordinate of the region, while bottom
represents the bottom-most coordinate of the region. But how do you figure out the appropriate values to set them?
In order to set these values, we highly recommend setting MeasuredByPercentage
to 1 to make this process as easy as possible. The next section assumes that this parameter is set to true.
For top
and bottom
, think of the height of the image or frame as a vertical axis that goes from 0 to 100:
Please follow this diagram for a visual representation of different regions with various top
and bottom
values:
Please note that the above diagram is not limiting the horizontal view at all.
After determining where you want the top-most and bottom-most points of the reading region, you can find its corresponding percentage value either by trial and error (and using the naked eye) or you can take exact measurements and use those to calculate the exact percentage values.
Now for left
and right
, think of the width of the image or frame as a horizontal axis that goes from 0 to 100:
The above diagram represents various percentages and their visual representation. This assumes that you are not restricting the vertical area and leaving top
and bottom
unaffected.
Now let’s group them all together to demonstrate various scanerios and their corresponding values
And that is pretty much a gist of how the RegionDefinition works. If anything is unclear, please contact support.
latest version