Web Demos

BARCODE READER SDK DEMO

Explore the flexibe barcode reading settings to optimize for your specific usage scenario.

WEB TWAIN SDK DEMO

Try the most popular web scanner features: scan images, import local images and PDF files, edit, save to local, upload to database, and etc.

BARCODE READER JAVASCRIPT DEMO

Transform any camera-equipped devices into real-time, browser-based barcode and QR code scanners.

MRZ SCANNER WEB DEMO

Detects the machine-readable zone of a passport, scans the text, and parses into human-readable data.

APP STORE DEMOS

BARCODE READER SDK FOR IOS

BARCODE READER SDK FOR ANDROID

VIEW MORE DEMOS >
Dev Center
Table of contents

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

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

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest version
  • Version 9.x
    • Version 9.2.0
    • Version 9.0.0
  • Version 8.x
    • Version 8.8.0
    • Version 8.6.0
    • Version 8.4.0
    • Version 8.2.0
    • Version 8.1.2
    • Version 8.1.0
    • Version 8.0.0
  • Version 7.x
    • Version 7.6.0
    • Version 7.5.0
Change +
© 2003–2022 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support