Thanks for downloading Dynamsoft Barcode Reader Package!
Your download will start shortly. If your download does not begin, click here to retry.
DeformationResistingModes
DeformationResistingModes
describes how to handle distorted and deformed barcodes. It consists of one or more modes, each mode representing a different way to implement the deformation resistance algorithm.
Candidate Mode List
- DRM_GENERAL
- DRM_BROAD_WARP
- DRM_LOCAL_REFERENCE
- DRM_DEWRINKLE
- DRM_AUTO
DRM_GENERAL
Resists deformation using the general algorithm. This mode has the following arguments for further customizing.
DRM_BROAD_WARP
Resists deformation when the barcode is warped gently. This mode has the following arguments for further customizing.
DRM_LOCAL_REFERENCE
Resists deformation for barcodes with minor deformation in local modules. This mode has the following arguments for further customizing.
DRM_DEWRINKLE
Resists deformation for barcodes on a wrinkled surface. This mode has the following arguments for further customizing.
DRM_AUTO
Lets the library choose a mode automatically.
Setting Methods
As PublicRuntimeSettings
Member
DeformationResistingModes
can be set dynamically during runtime as a member of FurtherModes
, which is a member of PublicRuntimeSettings
struct, it is an array with 8 DeformationResistingMode
Enumeration items.
Code Snippet in C++
//...other codes
PublicRuntimeSettings* pSettings = new PublicRuntimeSettings;
int errorCode = reader->GetRuntimeSettings(pSettings);
pSettings->deformationResistingModes[0] = DRM_GENERAL;
reader->UpdateRuntimeSettings(pSettings);
reader->SetModeArgument("DeformationResistingModes", 0, "Level", "1");
delete pSettings;
//...other codes
Remarks
GetModeArgument
and SetModeArgument
need to be called for getting and setting Arguments
.
See Also
FurtherModes:
C | C++ | .NET | Java | Java-Android | Objective-C & SwiftPublicRuntimeSettings:
JavaScript | C | C++ | .NET | Python | Java | Java-Android | Objective-C & SwiftDeformationResistingMode:
JavaScript | C | C++ | .NET | Python | Java | Java-Android | Objective-C & SwiftGetModeArgument:
JavaScript | C | C++ | .NET | Python | Java | Java-Android | Objective-C & SwiftSetModeArgument:
JavaScript | C | C++ | .NET | Python | Java | Java-Android | Objective-C & Swift
As JSON Parameter
DeformationResistingModes
as a JSON parameter is a JSON Object array. Each JSON object is defined as below.
Key Name | Key Value | Description |
---|---|---|
Mode | Any one in Candidate Mode List as string | (Required) Specifies a mode for deformation resisting. |
Level | A number from value range of Level | (Optional) Sets the Argument Level. |
GrayscaleEnhancementMode | A JSON object defined as GrayscaleEnhancementMode | (Optional) Sets the Argument GrayscaleEnhancementMode. |
BinarizationMode | A JSON object defined as BinarizationMode | (Optional) Sets the Argument BinarizationMode. |
LibraryFileName | A string from value range of LibraryFileName | (Optional) Sets the Argument LibraryFileName. |
LibraryParameters | A string from value range of LibraryFileName | (Optional) Sets the Argument LibraryFileName. |
JSON Parameter Example
{
"DeformationResistingModes": [
{
"Mode": "DRM_GENERAL",
"Level": 1
},
{
"Mode": "DRM_DEWRINKLE",
"GrayscaleEnhancementMode":{
"Mode": "GEM_SHARPEN_SMOOTH",
"SmoothBlockSizeX": 3,
"SmoothBlockSizeY": 3,
"SharpenBlockSizeX": 3,
"SharpenBlockSizeY": 3
},
"BinarizationMode":{
"Mode": "BM_LOCAL_BLOCK",
"BlockSizeX": 3,
"BlockSizeY": 3
}
}
]
}
Candidate Argument List
BinarizationMode
Sets the binarization process used for deformation resisting. It is a JSON object defined as below.
Key Name | Value Type | Value Range | Default Value | Description |
---|---|---|---|---|
Mode | string | BM_LOCAL_BLOCK BM_THRESHOLD |
BM_LOCAL_BLOCK |
(Required) Sets a binarization mode. |
BlockSizeX | int | [0, 1000] | 0 | (Optional) Sets the horizontal block size for the binarization process. Valid when mode is BM_LOCAL_BLOCK .0: The value will be set automatically by the SDK. |
BlockSizeY | int | [0, 1000] | 0 | (Optional) Sets the vertical block size for the binarization process. Valid when mode is BM_LOCAL_BLOCK .0: The value will be set automatically by the SDK. |
EnableFillBinaryVacancy | int | [0, 1] | 1 | (Optional) Sets whether to enable binary vacancy filling. Valid when mode is BM_LOCAL_BLOCK .0: disable 1: enable |
ThresholdCompensation | int | [-255, 255] or -10000 |
10 | (Optional) Sets the constant subtracted from the mean or weighted mean used for calculating the threshold. Valid when mode is BM_LOCAL_BLOCK .-10000: The library may try multiple values for current process. |
BinarizationThreshold | int | [-1, 255] | -1 | (Optional) Sets the binarization threshold. Valid when mode is BM_THRESHOLD .-1: The value will be set automatically by the SDK. |
MorphOperation | string | Erode Dilate Open Close |
Close |
(Optional) Sets the morph operation for the morphology process. Valid when mode is BM_LOCAL_BLOCK or BM_THRESHOLD . |
MorphShape | string | Rectangle Cross Ellipse |
Optional |
(Optional) Sets the morph shape for the morphology process. Valid when mode is BM_LOCAL_BLOCK or BM_THRESHOLD . |
MorphOperationKernelSizeX | int | [-1, 1000] | -1 | (Optional) Sets the horizontal kernel size for the morphology process. Valid when mode is BM_LOCAL_BLOCK or BM_THRESHOLD .- 0: The value will be set automatically by the SDK. -1: Skip the morph operation. |
MorphOperationKernelSizeY | int | [-1, 1000] | -1 | (Optional) Sets the vertical kernel size for the morphology process. Valid when mode is BM_LOCAL_BLOCK or BM_THRESHOLD .- 0: The value will be set automatically by the SDK. -1: Skip the morph operation. |
GrayscaleEnhancementMode
Sets the process used to enhance the quality of the grayscale image for deformation resisting. It is a JSON object defined as below.
Key Name | Value Type | Value Range | Default Value | Description |
---|---|---|---|---|
Mode | string | GEM_GENERAL GEM_GRAY_EQUALIZE GEM_GRAY_SMOOTH GEM_SHARPEN_SMOOTH |
GEM_GENERAL |
(Required) Sets a grayscale enhancement mode. |
Sensitivity | int | [1, 9] | 5 | (Optional) Sets the sensitivity to perform the equalization process. Valid when mode is GEM_GRAY_EQUALIZE .A larger value means a higher possibility that gray equalization will be activated. |
SmoothBlockSizeX | int | [3, 1000] | 3 | (Optional) Sets the horizontal block size (neighborhood pixel counts) for the smoothing process. Valid when mode is GEM_GRAY_SMOOTH or GEM_SHARPEN_SMOOTH . |
SmoothBlockSizeX | int | [3, 1000] | 3 | (Optional) Sets the vertical block size (neighborhood pixel counts) for the smoothing process. Valid when mode is GEM_GRAY_SMOOTH or GEM_SHARPEN_SMOOTH . |
SharpenBlockSizeX | int | [3, 1000] | 3 | (Optional) Sets the horizontal block size (neighborhood pixel counts) for the sharpening process. Valid when mode is GEM_SHARPEN_SMOOTH . |
SharpenBlockSizeY | int | [3, 1000] | 3 | (Optional) Sets the vertical block size (neighborhood pixel counts) for the sharpening process. Valid when mode is GEM_SHARPEN_SMOOTH . |
Level
Sets the effort level used for deformation resisting. Not supported yet.
Value Type | Value Range | Default Value | Valid For |
---|---|---|---|
int | [1, 9] | 5 | DRM_GENERAL |
Performance Adaptability
A larger value may improve the Read Rate but slowdown the Speed.
LibraryFileName
Sets the file name of the library to load dynamically.
Value Type | Value Range | Default Value | Valid For |
---|---|---|---|
string | A string value representing file name. | ”” | All modes |
Remarks
The library must be in the same place with Dynamsoft Barcode Reader Library.
LibraryParameters
Sets the parameters passed to the library to load dynamically.
Value Type | Value Range | Default Value | Valid For |
---|---|---|---|
string | A string value representing parameters. | ”” | All modes |