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.

How to Deal with Deformed Barcodes

The barcodes on the surface of some flexible packaging or cylindrical objects tend to be distorted and deformed. DBR may not be able to handle such cases well by default, but we can configure DeformationResistingModes to deal with these problems.

The following images show two kinds of barcode images with deformation:

Wrinkled distortion: Deformation sample image1 after deformation qr

Columnar distortion:

Deformation sample image2 Deformation sample image2

Currently, DeformationResistingModes only works for QR Code and DataMatrix codes.

How to configure

As mentioned above, you can configure the anti-deformation mode via the setting DeformationResistingModes. DBR does not turn on anti-deformation by default. If you want to turn it on, you need to add DRM_GENERAL to DeformationResistingModes. By the way, multiple modes can also be set at the same time. For example, if DRM_SKIP and DRM_GENERAL are configured at the same time, our algorithm will try to turn off and turn on the anti-deformation mode in turn, until the decoding result meets the requirements.

Example

The following code snippet shows how to enable deformation resisting mode via RuntimeSettings and JSON template individually.

  • Set via RuntimeSettings:
CBarcodeReader* reader = new CBarcodeReader();  
reader->InitLicense("Insert your license");  
PublicRuntimeSettings* runtimeSettings = new PublicRuntimeSettings();  
reader->GetRuntimeSettings(runtimeSettings); //Get the current runtimesettings  
runtimeSettings->furtherModes.deformationResistingModes[0] = DRM_GENERAL; // Turn on anti-deformation
char sError[512];  
reader->UpdateRuntimeSettings(runtimeSettings, sError, 512); // Update the runtimesettings
reader->DecodeFile("Insert your image file path", ""); // Start decoding
TextResultArray* paryResult = NULL;  
reader->GetAllTextResults(&paryResult); // Get results
dynamsoft::dbr::CBarcodeReader::FreeTextResults(&paryResult);  
delete runtimeSettings;  
delete reader;  
  • Set via JSON template:
{    
    "Version":"3.0",    
    "ImageParameter":    
    {    
         "Name":"IP1",    
         "BarcodeFormatIds":["BF_ALL"],        
         "DeformationResistingModes":["DRM_GENERAL"]
     }    
}   

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

latest version

  • Latest version
  • Version 10.x
    • Version 10.2.0
    • Version 10.0.21
    • Version 10.0.20
    • Version 10.0.10
    • Version 10.0.0
  • Version 9.x
    • Version 9.6.40
    • Version 9.6.33
    • Version 9.6.32
    • Version 9.6.31
    • Version 9.6.30
    • Version 9.6.20
    • Version 9.6.10
    • Version 9.6.0
    • Version 9.4.0
    • 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 +