Dynamsoft Barcode Reader - API Reference

ModesArgument

Arguments of AccompanyingTextRecognitionModes

Mode Parameter Name Argument Name Argument Description
AccompanyingTextRecognitionModes RegionBottom Specifies the y-coordinate of the bottom-right corner of the region in percentage. This value is relative to the top-left corner of the barcode.
Value Range :
[-10000, 10000]
Default Value :
0
Remarks:
Valid for ATRM_GENERAL
If RegionLeft, RegionTop, RegionRight and RegionBottom are all equal to 0, the accompanying text zone will be detected automatically by the SDK.
For more info on how to set a custom area for accompanying texts, please refer to this article
AccompanyingTextRecognitionModes RegionLeft Specifies the x-coordinate of the top-left corner of the region in percentage. This value is relative to the top-left corner of the barcode.
Value Range :
[-10000, 10000]
Default Value :
0
Remarks:
Valid for ATRM_GENERAL
If RegionLeft, RegionTop, RegionRight and RegionBottom are all equal to 0, the accompanying text zone will be detected automatically by the SDK.
For more info on how to set a custom area for accompanying texts, please refer to this article
AccompanyingTextRecognitionModes RegionRight Specifies the x-coordinate of the bottom-right corner of the region in percentage. This value is relative to the top-left corner of the barcode.
Value Range :
[-10000, 10000]
Default Value :
0
Remarks:
Valid for ATRM_GENERAL
If RegionLeft, RegionTop, RegionRight and RegionBottom are all equal to 0, the accompanying text zone will be detected automatically by the SDK.
For more info on how to set a custom area for accompanying texts, please refer to this article
AccompanyingTextRecognitionModes RegionTop Specifies the y-coordinate of the top-left corner of the region in percentage. This value is relative to the top-left corner of the barcode.
Value Range :
[-10000, 10000]
Default Value :
0
Remarks:
Valid for ATRM_GENERAL
If RegionLeft, RegionTop, RegionRight and RegionBottom are all equal to 0, the accompanying text zone will be detected automatically by the SDK.
For more info on how to set a custom area for accompanying texts, please refer to this article

Arguments of BarcodeColourModes

Mode Parameter Name Argument Name Argument Description
BarcodeColourModes LightReflection Sets if there is light reflection on the barocde zone.
Value Range :
[0, 1]
Default Value :
1
Remarks:
Valid for BICM_DARK_LIGHT_MIXED; BICM_DARK_ON_DARK; BICM_DARK_ON_LIGHT; BICM_LIGHT_ON_DARK;BICM_LIGHT_ON_LIGHT; BICM_DARK_ON_LIGHT_DARK_SURROUNDING
0: no light reflection
1: has light reflection

Arguments of BinarizationModes

Mode Parameter Name Argument Name Argument Description
BinarizationModes BlockSizeX Sets the horizontal block size for the binarization process.
Value Range :
[0, 1000]
Default Value :
0
Remarks:
Valid for BM_LOCAL_BLOCK
0: the block size used for binarization will be set to a value which is calculated automatically.
N:
1 <= N <= 3: the block size used for binarization will be set to 3.
N > 3: the block size used for binarization will be set to N.
Block size refers to the size of a pixel neighborhood used to calculate a threshold value for the pixel.
An appropriate value for binarizationBlockSize can help generate a high quality binary image and increase the accuracy of barcode localization.
BinarizationModes BlockSizeY Sets the vertical block size for the binarization process.
Value Range :
[0, 1000]
Default Value :
0
Remarks:
Valid for BM_LOCAL_BLOCK
0: the block size used for binarization will be set to a value which is calculated automatically.
N:
1 <= N <= 3: the block size used for binarization will be set to 3.
N > 3: the block size used for binarization will be set to N.
Block size refers to the size of a pixel neighborhood used to calculate a threshold value for the pixel.
An appropriate value for binarizationBlockSize can help generate a high quality binary image to increase the accuracy of barcode localization.
BinarizationModes EnableFillBinaryVacancy Sets whether to enable binary vacancy filling.
Value Range :
[0, 1]
Default Value :
1
Remarks:
Valid for BM_LOCAL_BLOCK
0 - disable, 1 - enable
For barcodes with a large module size, there might be a vacant area in the position detection pattern after binarization. The vacant area may result in decoding failure. Setting this to True will fill in the vacant area with black and may help improve the decoding success rate. Better accuracy for images with a large module size.
BinarizationModes ImagePreprocessingModesIndex The index of a specific image preprocessing mode in the ImagePreprocessingModes parameter which the current binarization mode is applied to.
Value Range :
[-1, 0x7fffffff]
Default Value :
-1
Remarks:
Valid for BM_LOCAL_BLOCK; BM_THRESHOLD
-1: The current binarization mode is applied to all modes in parameter ImagePreprocessingModes.
BinarizationModes ThreshValueCoefficient Constant subtracted from the mean or weighted mean. Normally, it is positive but may be zero or negative as well.
Value Range :
[-255, 255]
Default Value :
10
Remarks:
Valid for BM_LOCAL_BLOCK
BinarizationModes BinarizationThreshold Sets the threshold value which is used to classify the pixel values for binarization processing.
Value Range :
[-1, 255]
Default Value :
-1
Remarks :
Valid for BM_THRESHOLD
-1: The threshold value will be calculated automatically by the SDK.

Arguments of ColourClusteringModes

Mode Parameter Name Argument Name Argument Description
ColourClusteringModes Sensitivity Sets the sensitivity used for colour categorization.
Value Range :
[1, 9]
Default Value :
5
Remarks:
Valid for CCM_GENERAL_HSV
A higher level means less colours will be clustered as the same colour.

Arguments of ColourConversionModes

Mode Parameter Name Argument Name Argument Description
ColourConversionModes BlueChannelWeight Sets the weight value of Blue Colour Channel used for converting a colour image to a grayscale image.
Value Range :
[-1, 1000]
Default Value :
-1
Remarks:
Valid for CICM_GENERAL
-1: The weight value will be set automatically by the SDK.
ColourConversionModes GreenChannelWeight Sets the weight value of Green Colour Channel used for converting a colour image to a grayscale image.
Value Range :
[-1, 1000]
Default Value :
-1
Remarks:
Valid for CICM_GENERAL
-1: The weight value will be set automatically by the SDK.
ColourConversionModes RedChannelWeight Sets the weight value of Red Colour Channel used for converting a colour image to a grayscale image.
Value Range :
[-1, 1000]
Default Value :
-1
Remarks:
Valid for CICM_GENERAL
-1: The weight value will be set automatically by the SDK.

Arguments of DeformationResistingModes

Mode Parameter Name Argument Name Argument Description
DeformationResistingModes Level Sets the effort level used for deformation resisting. Not supported yet.
Value Range :
[1, 9]
Default Value :
5
Remarks:
Valid for DRM_GENERAL
A larger value means the library will take more effort to resist deformation.

Arguments of ImagePreprocessingModes

Mode Parameter Name Argument Name Argument Description
ImagePreprocessingModes Sensitivity Sets the sensitivity used for gray equalization.
Value Range :
[1, 9]
Default Value :
5
Remarks:
Valid for IPM_GRAY_EQUALIZE
If you have an image with a low level of contrast, you can set the property to a larger value.
A larger value means a higher possibility that gray equalization will be activated.
This may cause adverse effect on images with a high level of contrast.
ImagePreprocessingModes SmoothBlockSizeX Sets the horizontal block size for the smoothing process.
Value Range :
[3, 1000]
Default Value :
3
Remarks:
Valid for IPM_GRAY_SMOOTH;IPM_SHARPEN_SMOOTH
Block size refers to the size of a pixel neighborhood used to calculate the threshold for the pixel.
An appropriate value can help increase the accuracy of barcode localization.
ImagePreprocessingModes SmoothBlockSizeY Sets the vertical block size for the smoothing process.
Value Range :
[3, 1000]
Default Value :
3
Remarks:
Valid for IPM_GRAY_SMOOTH;IPM_SHARPEN_SMOOTH
Block size refers to the size of a pixel neighborhood used to calculate the threshold for the pixel.
An appropriate value can help increase the accuracy of barcode localization.
ImagePreprocessingModes SharpenBlockSizeX Sets the horizontal block size for the sharpening process.
Value Range :
[3, 1000]
Default Value :
3
Remarks:
Valid for IPM_SHARPEN_SMOOTH
Block size refers to the size of a pixel neighborhood used to calculate the threshold for the pixel.
An appropriate value can help increase the accuracy of barcode localization.
ImagePreprocessingModes SharpenBlockSizeY Sets the vertical block size for the sharpening process.
Value Range :
[3, 1000]
Default Value :
3
Remarks:
Valid for IPM_SHARPEN_SMOOTH
Block size refers to the size of a pixel neighborhood used to calculate the threshold for the pixel.
An appropriate value can help increase the accuracy of barcode localization.
ImagePreprocessingModes MorphOperation Sets the morph operation for the morphology process.
Value Range :
["Erode", "Dilate", "Open", "Close"]
Default Value :
"Close"
Remarks:
Valid for IPM_MORPHOLOGY.
ImagePreprocessingModes MorphShape Sets the morph shape for the morphology process.
Value Range :
["Rectangle", "Cross", "Ellipse"]
Default Value :
"Rectangle"
Remarks:
Valid for IPM_MORPHOLOGY.
ImagePreprocessingModes MorphOperationKernelSizeX Sets the horizontal kernel size for the morphology process.
Value Range :
[0, 1000]
Default Value :
0
Remarks:
Valid for IPM_MORPHOLOGY.
ImagePreprocessingModes MorphOperationKernelSizeY Sets the vertical kernel size for the morphology process.
Value Range :
[0, 1000]
Default Value :
0
Remarks:
Valid for IPM_MORPHOLOGY.

Arguments of IntermediateResultSavingMode

Mode Parameter Name Argument Name Argument Description
IntermediateResultSavingMode FolderPath Sets the path of the output folder which stores intermediate results.
Value Range :
A string value representing the folder path with max length 480.
Default Value :
""
Remarks:
Valid for IRSM_FILESYSTEM;IRSM_BOTH
"": The library path.
Please make sure the path exists and your application has the appropriate permissions for saving the results.
IntermediateResultSavingMode RecordsetSizeOfLatestImages Sets the maximum count of recordset to store the latest images' intermediate results.
Value Range :
[0,0x7fffffff]
Default Value :
0
Remarks:
Valid for IRSM_FILESYSTEM;IRSM_BOTH<br>
0 means no limitation on the count of recordset.
When the count exceeds, the old recordset will be replaced by the new one.

Arguments of LocalizationModes

Mode Parameter Name Argument Name Argument Description
LocalizationModes ModuleSize Sets the barcode module size for searching barcode when using LM_CENTRE mode.
Value Range :
[0, 0x7fffffff]
Default Value :
0
Remarks:
Valid for LM_CENTRE.
0: means automatically set by the library.
LocalizationModes ScanStride Sets the stride in pixels between scans when searching for barcodes.
Value Range :
[0, 0x7fffffff]
Default Value :
0
Remarks:
Valid for LM_SCAN_DIRECTLY
0: means automatically set by the library.
When the set value is greater than half the width or height of the current image, the actual processing is 0.
LocalizationModes ScanDirection Sets the scan direction when searching barcode.
Value Range : [0,2]
Default Value :
0
Remarks:
Valid for LM_SCAN_DIRECTLY
0: Both vertical and horizontal direction
1: Vertical direction
2: Horizontal direction.

Arguments of RegionPredetectionModes

Mode Parameter Name Argument Name Argument Description
RegionPredetectionModes MinImageDimension Sets the minimum image dimension (in pixels) to pre-detect barcode regions.
Value Range :
[16384, 0x7fffffff]
Default Value :
262144
Remarks:
Valid for RPM_GENERAL_GRAY_CONTRAST;RPM_GENERAL_HSV_CONTRAST;RPM_GENERAL_RGB_CONTRAST
If the image dimension is larger than the given value, the library will enable the feature of pre-detecting barcode regions. Otherwise, it will skip this step when searching for barcodes.
RegionPredetectionModes Sensitivity Sets the sensitivity used for region predetection algorithm.
Value Range :
[1, 9]
Default Value :
1
Remarks:
Valid for RPM_GENERAL_GRAY_CONTRAST;RPM_GENERAL_HSV_CONTRAST;RPM_GENERAL_RGB_CONTRAST
A larger value means the library will take more effort to detect regions.
RegionPredetectionModes RelativeBarcodeRegions Sets the barcode regions relative to the predetected region.
Default Value :
""
Remarks:
Valid for RPM_GENERAL_GRAY_CONTRAST;RPM_GENERAL_HSV_CONTRAST;RPM_GENERAL_RGB_CONTRAST;
1. Here is an example to define a region: [Left, Top, Right, Bottom, Index]
2. If you want to define multiple regions, you can use a ";" to separate them.
3. The allowed values for Left, Top, Right and Bottom is [-10000,10000]
4. The ordinate origin is the top-left corner of the rectangle of the predetected region.
5. The value of Left/Right is a percentage value relative to the width of the predetected region.
6. The value of Top/Bottom is a percentage value relative to the height of the predetected region.
7. Index: The index of a specific colour set in ForeAndBackgroundColours which the current region is applied to.
8. The allowed values for Index is [-1, 0x7fffffff].
9. Index = -1: The current region is applied to all colour sets in ForeAndBackgroundColours.
For more info on how to set a relative barcode region, please refer to this article.
RegionPredetectionModes ForeAndBackgroundColours Sets the foreground and background colour pairs used for region predetected algorithm.
Default Value :
""
Remarks:
Valid for RPM_GENERAL_GRAY_CONTRAST;RPM_GENERAL_HSV_CONTRAST;RPM_GENERAL_RGB_CONTRAST;
1. Here is an example to define a set of colours: [ForegroundColour, BackgroundColour, Tolerance]
2. If you want to define multiple sets of colours, please use ";" to separate them.
3. The allowed values for ForegroundColour and BackgroundColour is [-1, 360] for RPM_GENERAL_HSV_CONTRAST;
4. The allowed values for ForegroundColour and BackgroundColour is [0, 255] for RPM_GENERAL_GRAY_CONTRAST and RPM_GENERAL_RGB_CONTRAST;.
5. For RPM_GENERAL_HSV_CONTRAST, the value for ForegroundColour and BackgroundColour is the Hue value in the HSV colour space, -1 means black, gray, white;
6. For RPM_GENERAL_GRAY_CONTRAST, the value for ForegroundColour and BackgroundColour is the grayscale value;
7. For RPM_GENERAL_RGB_CONTRAST, the value for ForegroundColour and BackgroundColour is the average colour value of RGB channels;
8. For RPM_GENERAL_HSV_CONTRAST, the allowed values for Tolerance is [0, 360]. It is an amount of colour tolerance which is used to indicate whether the surrounding colour of ForegroundColour/BackGroundColour will be regarded as the same colour;
9. For RPM_GENERAL_GRAY_CONTRAST and RPM_GENERAL_RGB_CONTRAST, the allowed values for Tolerance is [0, 255]. It is an amount of colour tolerance which is used to indicate whether the surrounding colour of ForegroundColour/BackGroundColour will be regarded as the same colour.
RegionPredetectionModes AspectRatioRange Sets the aspect ratio range of the outsourcing rectangle of the predetected region.
Default Value :
""
Remarks:
Valid for RPM_GENERAL_GRAY_CONTRAST;RPM_GENERAL_HSV_CONTRAST;RPM_GENERAL_RGB_CONTRAST;
1. An example to set the aspect ratio range: [MinAspectRatio, MaxAspectRatio]
2. The allowed values for MinAspectRatio, MaxAspectRatio is [1,10000], which is the aspect ratio for height/width.
RegionPredetectionModes HeightRange Sets the height range of the outsourcing rectangle of the predetected region.
Default Value :
""
Remarks:
Valid for RPM_GENERAL_GRAY_CONTRAST;RPM_GENERAL_HSV_CONTRAST;RPM_GENERAL_RGB_CONTRAST;
1. An example to set height range: [MinHeight, MaxHeight]
2. The allowed values for MinHeight and MaxHeight is [1,0x7fffffff].
RegionPredetectionModes WidthRange Sets the width range of the outsourcing rectangle of the predetected region.
Default Value :
""
Remarks:
Valid for RPM_GENERAL_GRAY_CONTRAST;RPM_GENERAL_HSV_CONTRAST;RPM_GENERAL_RGB_CONTRAST;
1. An example to set width range: [MinWidth, MaxWidth]
2. The allowed values for MinWidth and MaxWidth is [1,0x7fffffff]

Arguments of ScaleUpModes

Mode Parameter Name Argument Name Argument Description
ScaleUpModes AcuteAngleWithXThreshold Sets the acute angle threshold for scale-up.
Value Range :
[-1, 90]
Default Value :
-1
Remarks:
Valid for SUM_LINEAR_INTERPOLATION, SUM_NEAREST_NEIGHBOUR_INTERPOLATION
-1 : means automatically set by the library.
If the module size of the barcode is smaller than the ModuleSizeThreshold and the acute angle with X of the barcode is larger than the AcuteAngleWithXThreshold, the barcode will be enlarged to N times (N=1,2,3...) till N * modulesize >= TargetModuleSize.
For more info on how to custom scale up rules, please refer to this article
ScaleUpModes ModuleSizeThreshold Sets the module size threshold for scale-up.
Value Range :
[0, 0x7fffffff]
Default Value :
0
Remarks:
Valid for SUM_LINEAR_INTERPOLATION, SUM_NEAREST_NEIGHBOUR_INTERPOLATION
0 : means automatically set by the library.
If the module size of the barcode is smaller than the ModuleSizeThreshold and the acute angle with X of the barcode is larger than the AcuteAngleWithXThreshold, the barcode will be enlarged to N times (N=1,2,3...) till N * modulesize >= TargetModuleSize.
For more info on how to custom scale up rules, please refer to this article
ScaleUpModes TargetModuleSize Sets the target module size for scale-up.
Value Range :
[0, 0x7fffffff]
Default Value :
0
Remarks:
Valid for SUM_LINEAR_INTERPOLATION, SUM_NEAREST_NEIGHBOUR_INTERPOLATION
0 : means automatically set by the library.
If the module size of the barcode is smaller than the ModuleSizeThreshold and the acute angle with X of the barcode is larger than the AcuteAngleWithXThreshold, the barcode will be enlarged to N times (N=1,2,3...) till N * modulesize >= TargetModuleSize.
For more info on how to custom scale up rules, please refer to this article

Arguments of TextAssistedCorrectionMode

Mode Parameter Name Argument Name Argument Description
TextAssistedCorrectionMode BottomTextPercentageSize Sets the percentage of the bottom accompanying text zone comparing to the barcode zone.
Value Range :
[0, 255]
Default Value :
0
Remarks:
Valid for TACM_VERIFYING;TACM_VERIFYING_PATCHING
255: The accompanying text zone will be detected automatically by the SDK.
TextAssistedCorrectionMode LeftTextPercentageSize Sets the percentage of the left accompanying text zone comparing to the barcode zone.
Value Range :
[0, 255]
Default Value :
0
Remarks:
Valid for TACM_VERIFYING;TACM_VERIFYING_PATCHING
255: The accompanying text zone will be detected automatically by the SDK.
TextAssistedCorrectionMode RightTextPercentageSize Sets the percentage of the right accompanying text zone comparing to the barcode zone.
Value Range :
[0, 255]
Default Value :
0
Remarks:
Valid for TACM_VERIFYING;TACM_VERIFYING_PATCHING
255: The accompanying text zone will be detected automatically by the SDK.
TextAssistedCorrectionMode TopTextPercentageSize Sets the percentage of the top accompanying text zone comparing to the barcode zone.
Value Range :
[0, 255]
Default Value :
0
Remarks:
Valid for TACM_VERIFYING;TACM_VERIFYING_PATCHING
255: The accompanying text zone will be detected automatically by the SDK.

Arguments of TextFilterModes

Mode Parameter Name Argument Name Argument Description
TextFilterModes MinImageDimension Sets the minimum image dimension (in pixels) to filter the text.
Value Range :
[65536, 0x7fffffff]
Default Value :
65536
Remarks:
Valid for TFM_GENERAL_CONTOUR
If the image dimension is larger than the given value, the library will enable the text filtering feature. Otherwise, it will skip this step when doing barcode recognition.
The feature can speed up the recognition process.
TextFilterModes Sensitivity Sets the sensitivity used for text filtering.
Value Range :
[0, 9]
Default Value :
0
Remarks:
Valid for TFM_GENERAL_CONTOUR
0: means automatically set by the library.
A larger value means the library will take more effort to filter text.

Arguments of TextureDetectionModes

Mode Parameter Name Argument Name Argument Description
TextureDetectionModes Sensitivity Sets the sensitivity used for texture detection.
Value Range :
[1, 9]
Default Value :
5
Remarks:
Valid for TDM_GENERAL_WIDTH_CONCENTRATION
A larger value means the library will take more effort to detect texture.