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.

Read Deformed Barcodes

As shown below, barcodes on the surface of some flexible packaging or cylindrical objects tend to be distorted and deformed.

Deformed Barcodes

Deformed Barcodes

By default, DBR may not handle such cases well. To get such images decoded, enable deformation resistance by adding DRM_BROAD_WARP, DRM_LOCAL_REFERENCE and DRM_DEWRINKLE to DeformationResistingModes. Here is a quick breakdown of each of the modes:

  • DRM_BROAD_WARP: Resists deformation when the barcode is warped gently.
  • DRM_LOCAL_REFERENCE: Resists deformation for barcodes with minor deformation in local modules.
  • DRM_DEWRINKLE: Resists deformation for barcodes on a wrinkled surface.

Note:

DeformationResistingModes only works for QR Code and DataMatrix codes.

You can either specify one of the DeformationResistingModes or add all of them. If mulpitle modes are specified, the library will switch between the modes automatically until the number of detected barcodes meets the ExpectedBarcodeCount.

Code Snippet

  • JavaScript
  • Android
  • Objective-C
  • Swift
  • C
  • C++
  • C#
  • Java
  • Python
// Obtains the current runtime settings of DBR.
let settings = await scanner.getRuntimeSettings();
// Adds DRM_GENERAL to deformationResistingModes.
settings.furtherModes.deformationResistingModes = [Dynamsoft.DBR.EnumDeformationResistingMode.DRM_BROAD_WARP, Dynamsoft.DBR.EnumDeformationResistingMode.DRM_LOCAL_REFERENCE, Dynamsoft.DBR.EnumDeformationResistingMode.DRM_DEWRINKLE];
// Updates the settings.
await scanner.updateRuntimeSettings(settings);
// Obtain current runtime settings of `reader` instance.
PublicRuntimeSettings settings = reader.getRuntimeSettings();
// Add DRM_GENERAL to the deformationResistingModes to decode deformed barcodes.
settings.furtherModes.deformationResistingModes = new int[]{EnumDeformationResistingMode.DRM_BROAD_WARP, EnumDeformationResistingMode.DRM_LOCAL_REFERENCE,EnumDeformationResistingMode.DRM_DEWRINKLE};
// Update the settings.
reader.updateRuntimeSettings(settings);
NSError* err = nil;
// Obtain current runtime settings of `reader` instance.
iPublicRuntimeSettings* settings = [reader getRuntimeSettings:&err];
// Add DRM_GENERAL to the deformationResistingModes to decode deformed barcodes.
settings.furtherModes.deformationResistingModes = @[@(EnumDeformationResistingModeBroadWarp),@(EnumDeformationResistingModeLocalReference),@(EnumDeformationResistingModeDewrinkle)];
// Update the settings.
[reader updateRuntimeSettings:settings error:&err];
// Obtain current runtime settings of `barcodeReader` instance.
let settings = try? barcodeReader.getRuntimeSettings()
// Add DRM_GENERAL to the deformationResistingModes to decode deformed barcodes.
settings?.furtherModes.deformationResistingModes = [EnumDeformationResistingMode.broadwarp,EnumDeformationResistingMode.localReference,EnumDeformationResistingMode.dewrinkle]
// Update the settings.
try? barcodeReader.updateRuntimeSettings(settings!)
PublicRuntimeSettings settings;
char szErrorMsg[256] = {0};
// Obtain current runtime settings of `reader` instance.
DBR_GetRuntimeSettings(reader, &settings);
// Add DRM_GENERAL to the deformationResistingModes to decode deformed barcodes.
settings.furtherModes.deformationResistingModes[0] = DRM_BROAD_WARP;
settings.furtherModes.deformationResistingModes[1] = DRM_LOCAL_REFERENCE;
settings.furtherModes.deformationResistingModes[2] = DRM_DEWRINKLE;
// Update the settings.
DBR_UpdateRuntimeSettings(reader, &settings, szErrorMsg, 256);
PublicRuntimeSettings settings;
char szErrorMsg[256] = {0};
// Obtain current runtime settings of `reader` instance.
reader.GetRuntimeSettings(&settings);
// Add DRM_GENERAL to the deformationResistingModes to decode deformed barcodes.
settings.furtherModes.deformationResistingModes[0] = DRM_BROAD_WARP;
settings.furtherModes.deformationResistingModes[1] = DRM_LOCAL_REFERENCE;
settings.furtherModes.deformationResistingModes[2] = DRM_DEWRINKLE;
// Update the settings.
reader.UpdateRuntimeSettings(&settings, szErrorMsg, 256);
// Obtain current runtime settings of `reader` instance.
PublicRuntimeSettings settings = reader.GetRuntimeSettings();
// Add DRM_GENERAL to the deformationResistingModes to decode deformed barcodes.
settings.FurtherModes.DeformationResistingModes[0] = DRM_BROAD_WARP;
settings.FurtherModes.DeformationResistingModes[1] = DRM_LOCAL_REFERENCE;
settings.FurtherModes.DeformationResistingModes[2] = DRM_DEWRINKLE;
// Update the settings.
reader.UpdateRuntimeSettings(settings);
// Obtain current runtime settings of `reader` instance.
PublicRuntimeSettings settings = reader.getRuntimeSettings();
// Add DRM_GENERAL to the deformationResistingModes to decode deformed barcodes.
settings.furtherModes.deformationResistingModes = new int[]{EnumDeformationResistingMode.DRM_BROAD_WARP, EnumDeformationResistingMode.DRM_LOCAL_REFERENCE,EnumDeformationResistingMode.DRM_DEWRINKLE};
// Update the settings.
reader.updateRuntimeSettings(settings);
# Obtain current runtime settings of `reader` instance.
settings = reader.get_runtime_settings()
# Add DRM_GENERAL to the deformationResistingModes to decode deformed barcodes.
settings.deformation_resisting_modes[0] = EnumDeformationResistingMode.DRM_BROAD_WARP
settings.deformation_resisting_modes[1] = EnumDeformationResistingMode.DRM_LOCAL_REFERENCE
settings.deformation_resisting_modes[2] = EnumDeformationResistingMode.DRM_DEWRINKLE
# Update the settings.
reader.update_runtime_settings(settings)

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

In this article:

version 9.6.40

  • 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 +