×
MENU
Resource Base
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

Is this page helpful?

YesYes NoNo

latest version

  • Latest Version
  • version 8.1.2
  • version 8.0
  • version 7.6
  • version 7.5
Change +
© 2003–2020 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support