Table of contents

Need better scanning performance?

Get a FREE customized reading template.

LocalizationModes

Parameter LocalizationModes determines how to localize barcodes. It consists of one or more modes, each mode representing a different localization process.

JSON Structure

Location in template:

BarcodeReaderTaskSettingOptions[i]
    ├── SectionArray[j]
    │   └── StageArray[k] (Stage object)
    │       └── LocalizationModes

Parent object: LocalizeCandidateBarcodesStage object

Example:

{
    "LocalizationModes": [
        {
            "Mode": "LM_CONNECTED_BLOCKS"
        },
        {
            "Mode": "LM_SCAN_DIRECTLY",
            "ScanDirection": 0,
            "ScanStride": 0
        }
    ]
}
  • This snippet shows only the LocalizationModes parameter.
  • To use it, embed this parameter within a Stage object at the SST_LOCALIZE_CANDIDATE_BARCODES stage.
  • For the complete JSON structure, see:

Parameter Details

Parameter LocalizationModes consists of a group of localization mode objects. Each localization mode object includes a candidate mode and a series of auxiliary mode arguments.

Mode Arguments

The mode arguments of the localization mode object are shown as follows:

Mode Arguments

Mode Argument Name Mode Argument Summary
Mode
(Required)
Description
Any one in Candidate Mode List as string
Type
String
Candidate Mode List
LM_CONNECTED_BLOCKS
LM_LINES
LM_NEURAL_NETWORK
LM_SCAN_DIRECTLY
LM_STATISTICS
LM_STATISTICS_MARKS
LM_STATISTICS_POSTAL_CODE
LM_CENTRE
LM_ONED_FAST_SCAN
LM_SKIP
ScanStride
(Optional)
Description
Sets the interval (in pixels) between adjacent scan lines when searching for barcodes.
Type
int
Range
[0,0x7fffffff]
Default Value
0
Remarks
0: Let the library automatically calculates the interval.
The smaller the value is, the more likely it is to locate the code area, but it will also increase the time.
Valid For
LM_SCAN_DIRECTLY
LM_ONED_FAST_SCAN
ScanDirection
(Optional)
Description
Sets the scan direction when searching barcode.
Type
int
Range
[0,2]
Default Value
0
Remarks
0: Both vertical and horizontal direction.
1: Vertical direction.
2: Horizontal direction.
Valid For
LM_SCAN_DIRECTLY
LM_ONED_FAST_SCAN
ConfidenceThreshold
(Optional)
Description
Sets the confidence threshold.
Type
int
Range
[0,100]
Default Value
60
Valid For
LM_ONED_FAST_SCAN
IsOneDStacked
(Optional)
Description
Sets whether the oned barcodes are stacked.
Type
int
Range
[0, 1]
Default Value
0
Valid For
LM_SCAN_DIRECTLY
ModuleSize
(Optional)
Description
Set the module size, if the module size is known.
Type
int
Range
[0, 0x7fffffff]
Default Value
0
Valid For
LM_CENTRE
ModelNameArray
(Optional)
Description
Sets the names of a barcode localization model.
Type
String Array
Range
Each element is the name of a model.
Candidate values: "OneDLocalization", "DataMatrixQRCodeLocalization", "PDF417Localization".
"OneDLocalization": for OneD barcodes.
"DataMatrixQRCodeLocalization": for DataMatrix and QRCode barcodes.
"PDF417Localization": for PDF417 barcodes. Introduced in version 11.4.1000.
Default Value
null
Valid For
All candidate modes.
Remarks
Introduced in version 11.2.1000.
When set to null in version 11.2.1000, "OneDLocalization", "DataMatrixQRCodeLocalization" models will be used by default.
When set to null in version 11.4.1000, "OneDLocalization", "DataMatrixQRCodeLocalization", "PDF417Localization" models will be used by default.

Default Setting

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

{
    "LocalizationModes": [
        {
            "Mode": "LM_CONNECTED_BLOCKS"
        },
        {
            "Mode": "LM_SCAN_DIRECTLY",
            "IsOneDStacked": 0,
            "ScanDirection": 0,
            "ScanStride": 0
        },
        {
            "Mode": "LM_STATISTICS"
        },
        {
            "Mode": "LM_LINES"
        }
    ]
}

If you specify a localization mode object with the Mode Argument “Mode” only, the default values of the other mode arguments will be used.

Candidate Mode Introductions

LM_CONNECTED_BLOCKS

Localizes barcodes by searching for connected blocks. It is optimized for clear images with obvious connected blocks. This algorithm usually gives best result and it is recommended to set as highest priority.

Available Mode Arguments:

  • ModelNameArray

LM_STATISTICS

Localizes barcodes by groups of contiguous black-white regions. This is optimized for QRCode and DataMatrix.

Available Mode Arguments:

  • ModelNameArray

LM_LINES

Localizes barcodes by searching for groups of lines. It is optimized for 1D and PDF417 barcodes which are with obvious straight lines. Compared with the LM_CONNECTED_BLOCKS mode, it can handle the situation where some bars (or lines) of the barcode stick to each other.

Available Mode Arguments:

  • ModelNameArray

LM_SCAN_DIRECTLY

Localizes barcodes based on the direct scanning mode. It is the fastest among all localization modes, but it requires high barcode image quality, and the direction of the barcode must be horizontal or vertical. This mode is recommended in the real-time video scanning scenarios.

Available Mode Arguments:

  • ScanStride
  • ScanDirection
  • IsOneDStacked
  • ModelNameArray

LM_STATISTICS_MARKS

Localizes barcodes by dot matrix information. This mode is only applicable to DPM Code and DotCode.

Available Mode Arguments:

  • ModelNameArray

LM_STATISTICS_POSTAL_CODE

Localizes barcodes by statistics, connected blocks and straight lines. This is optimized for postal codes.

Available Mode Arguments:

  • ModelNameArray

LM_CENTRE

Localizes barcodes from the centre of the image. This mode uses the central area of the image as the suspected code area and then try to localize and decode.

Available Mode Arguments:

  • ModuleSize
  • ModelNameArray

LM_ONED_FAST_SCAN

Localizes 1D barcodes in a fast mode. This mode is designed for reading 1D barcodes in a very fast mode.

Available Mode Arguments:

  • ScanStride
  • ScanDirection
  • ConfidenceThreshold
  • ModelNameArray

LM_NEURAL_NETWORK

Localizes barcodes by utilizing a neural network model.

Available Mode Arguments:

  • ModelNameArray

This page is compatible for: