Decoding Deformed QR Codes: Challenges & Solutions

scanning-warped-barcodes

QR codes have become critical in various applications, enabling contactless payments, event ticketing, inventory management, and marketing. Their ability to store information quickly makes them invaluable in our increasingly digital world. However, challenging QR codes can pose difficulties for barcode scanners.

In real-world scenarios, QR codes frequently undergo physical or digital changes as a result of handling, design choices, or varying environmental conditions. These alterations can cause deformed QR codes, such as warped, distorted, and crumpled versions. Such deformations might make scanning more difficult, emphasizing the need for reliable solutions and advanced tools. This blog delves into the various sorts of QR code deformations, the issues they present, and practical ways for properly decoding them.

Understanding QR Code Deformations

Deformed QR codes are those barcodes whose structural integrity has been impaired. Flexible materials, poor handling, and environmental conditions are common causes of these issues. For example, codes printed on curved surfaces may lead to warped QR codes, and resizing or stretching might cause distortion. In contrast, crumpled QR codes are the consequence of physical wrinkles or folds.

Impact on Scanning

The structured grid of a QR code is critical for accurate decoding. Deformations affect the alignment of the modules (little black and white squares) and the finder patterns (corner squares used for positioning), causing scanning issues. Misaligned or hidden components make it difficult for ordinary scanning apps to retrieve embedded data.

Types of QR Code Deformations and Their Challenges

Warped QR Codes

warped-barcodes

Definition: Warped QR codes occur when they are printed on a curved or bent surface, such as a flexible banner or a bottle label.

Effects: The bending damages the square structure by transforming straight lines into curves and misaligning the modules.

Challenges:

  • Accurately detecting the finder patterns becomes a challenge for standard scanners due to curvature.
  • It requires enhanced algorithms to fix the bending and aligning of the warped QR codes.

Distorted QR Codes

distorted-qr-code

Definition: Skewing or resizing leads to distorted QR codes, altering the spatial arrangement and proportion of the modules.

Effects: Distortion alters the grid-like layout of the QR code, which results in uneven spacing between modules and potential decoding errors.

Challenges:

  • As the spatial relationships between modules deviate from the standard structure, QR code decoding becomes challenging.
  • Extreme distortion may leave the QR code unreadable requiring an advanced barcode scanning solution.

Crumpled QR Codes

crumpled-qr-code

Definition: Crumpled QR codes are caused by folds, wrinkles, or physical damage to the surface, often seen on paper-based codes in retail settings.

Effects: Creases obscure parts of the QR code and create irregularities that disrupt its overall pattern.

Challenges:

  • Critical elements may be blocked, leading to incomplete or failed scans.
  • While error correction in QR codes can recover some lost data, severe crumpling can exceed these limits.

How to Scan Deformed QR Codes with Dynamsoft Barcode Reader

While ordinary barcode readers may fail to read deformed barcodes, Dynamsoft Barcode Reader is an enterprise-grade barcode scanning solution designed to tackle the most challenging barcodes, from crumpled to incomplete. Its configurable parameters allow developers to fine-tune settings such as focus, lighting, and decoding algorithms to enhance performance for specific conditions and barcode types.

Dynamsoft Barcode Reader offers the parameter DeformationResistingModes that defines how to handle distorted and deformed barcodes. The parameter consists of a collection of deformation resistant mode objects. Each deformation resisting mode object contains a candidate mode and a set of auxiliary mode arguments.

Download the Dynamsoft Barcode Reader SDK Free Trial to try the JSON template below. After you’ve successfully downloaded the SDK and activated the trial key, you can follow these steps to scan deformed QR codes, such as warped, distorted, or crumpled:

JSON Template:

{ 
  "ImageParameter": { 
    "BarcodeFormatIds": [ 
      "BF_QR_CODE", 
      "BF_MICRO_QR" 
    ], 
    "BarcodeFormatIds_2": [ 
      "BF2_NULL" 
    ], 
    "DeformationResistingModes": [ 
      { 
        "Level": 5, 
        "LibraryFileName": "", 
        "LibraryParameters": "", 
        "Mode": "DRM_GENERAL" 
      }, 
      { 
        "Level": 5, 
        "LibraryFileName": "", 
        "LibraryParameters": "", 
        "Mode": "DRM_BROAD_WARP" 
      }, 
      { 
        "Level": 5, 
        "LibraryFileName": "", 
        "LibraryParameters": "", 
        "Mode": "DRM_DEWRINKLE" 
      } 
    ], 
    "ImagePreprocessingModes": [ 
      { 
        "LibraryFileName": "", 
        "LibraryParameters": "", 
        "Mode": "IPM_GENERAL" 
      }, 
      { 
        "LibraryFileName": "", 
        "LibraryParameters": "", 
        "Mode": "IPM_GRAY_EQUALIZE", 
        "Sensitivity": 5 
      }, 
      { 
        "LibraryFileName": "", 
        "LibraryParameters": "", 
        "Mode": "IPM_GRAY_SMOOTH", 
        "SmoothBlockSizeX": 3, 
        "SmoothBlockSizeY": 3 
      }, 
      { 
        "LibraryFileName": "", 
        "LibraryParameters": "", 
        "Mode": "IPM_SHARPEN_SMOOTH", 
        "SharpenBlockSizeX": 3, 
        "SharpenBlockSizeY": 3, 
        "SmoothBlockSizeX": 3, 
        "SmoothBlockSizeY": 3 
      } 
    ], 
    "Description": "", 
    "Name": "Settings", 
    "Timeout": 99999 
  }, 
  "Version": "3.0" 
} 

JavaScript Code Snippet to Use the Template:

barcodeReader.initRuntimeSettingsWithString(template); 

Online demo

Get in Touch with the Dynamsoft Technical Support Team

At Dynamsoft, we assist developers in incorporating barcode scanning into web, desktop, and mobile applications, streamlining workflows, and reducing costs. We constantly enhance our solutions to meet the demands of the most challenging enterprise environments.

If you have questions about QR code scanning or are facing any challenges, please get in touch with the Dynamsoft technical support team.

Download Dynamsoft Barcode Reader SDK 30-Day Free Trial

Download Barcode Testing Sheet and Test Dynamsoft Barcode Reader Now