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 read high-density QR Codes

A QR code can store up to 7,089 numbers, 4,296 alphanumeric characters, 2,953 bytes, or 1,817 Japanese Kanjis. As the encoded information increases, the QR code becomes denser. The diagram below displays a QR code that has high density.

High-density QR Code

Figure 1 – High-density QR Code

In some scenarios, high-density QR codes become more difficult to locate and recognize due to small barcode images, perspective, and distortion.

We can do the following to optimize the read rate of high-density QR codes:

  • Scale up modules if they are too small
  • Sharpen the image
  • Run gray equalization

The following code snippet shows how to configure the parameters via a json template string.

  • JavaScript
  • Android
  • Objective-C
  • Swift
  • Python
  • Java
  • C#
  • C++
  • C
const scanner = await Dynamsoft.DBR.BarcodeScanner.createInstance();
// Allow js to directly process 4K images in canvas without compressing them.
// Please test on the target devices. On devices with limited memory, the settings can lead to out of memory.
scanner.maxCvsSideLength = 4096;
// Defines settings for reading dense barcodes in a template.
let jsonString = "{\"ImageParameter\":{\"BarcodeComplementModes\":[\"BCM_SKIP\"],\"DeblurModes\":[{\"Mode\":\"DM_SHARPENING\"},{\"Mode\":\"DM_GRAY_EQUALIZATION\"}],\"ExpectedBarcodesCount\":1,\"LocalizationModes\":[\"LM_CONNECTED_BLOCKS\"],\"ScaleUpModes\":[\"SUM_LINEAR_INTERPOLATION(0,4,6)\"],\"MaxAlgorithmThreadCount\":1,\"Name\":\"high-density-qr-tpl\",\"ScaleDownThreshold\":10000,\"Timeout\":5000},\"Version\":\"3.0\"}";
// Configures the BarcodeScanner object with the settings.
await scanner.initRuntimeSettingsWithString(jsonString);
scanner.show();
String jsonPara = "{\"ImageParameter\":{\"BarcodeComplementModes\":[\"BCM_SKIP\"],\"DeblurModes\":[{\"Mode\":\"DM_SHARPENING\"},{\"Mode\":\"DM_GRAY_EQUALIZATION\"}],\"ExpectedBarcodesCount\":1,\"LocalizationModes\":[\"LM_CONNECTED_BLOCKS\"],\"ScaleUpModes\":[\"SUM_LINEAR_INTERPOLATION(0,4,6)\"],\"MaxAlgorithmThreadCount\":1,\"Name\":\"high-density-qr-tpl\",\"ScaleDownThreshold\":10000,\"Timeout\":5000},\"Version\":\"3.0\"}";
// Apply the template string to the reader.
reader.initRuntimeSettingsWithString(jsonPara, EnumConflictMode.CM_OVERWRITE);
TextResult[] result = reader.decodeFile("YOUR-IMAGE-FILE-PATH");
NSError* err = nil;
NSString* jsonPara = @"{\"ImageParameter\":{\"BarcodeComplementModes\":[\"BCM_SKIP\"],\"DeblurModes\":[{\"Mode\":\"DM_SHARPENING\"},{\"Mode\":\"DM_GRAY_EQUALIZATION\"}],\"ExpectedBarcodesCount\":1,\"LocalizationModes\":[\"LM_CONNECTED_BLOCKS\"],\"ScaleUpModes\":[\"SUM_LINEAR_INTERPOLATION(0,4,6)\"],\"MaxAlgorithmThreadCount\":1,\"Name\":\"high-density-qr-tpl\",\"ScaleDownThreshold\":10000,\"Timeout\":5000},\"Version\":\"3.0\"}";
// Apply the template string to the reader.
[reader initRuntimeSettingsWithString:jsonPara conflictMode:EnumConflictModeOverwrite error:&err];
NSArray<iTextResult*>* result = [reader decodeFileWithName:"YOUR-IMAGE-FILE-PATH" error:&err];
let jsonPara = "{\"ImageParameter\":{\"BarcodeComplementModes\":[\"BCM_SKIP\"],\"DeblurModes\":[{\"Mode\":\"DM_SHARPENING\"},{\"Mode\":\"DM_GRAY_EQUALIZATION\"}],\"ExpectedBarcodesCount\":1,\"LocalizationModes\":[\"LM_CONNECTED_BLOCKS\"],\"ScaleUpModes\":[\"SUM_LINEAR_INTERPOLATION(0,4,6)\"],\"MaxAlgorithmThreadCount\":1,\"Name\":\"high-density-qr-tpl\",\"ScaleDownThreshold\":10000,\"Timeout\":5000},\"Version\":\"3.0\"}"
// Apply the template string to the reader.
try? reader.initRuntimeSettingsWithString(jsonPara,conflictMode:EnumConflictMode.overwrite)
let result = try? reader.decodeFileWithName("YOUR-IMAGE-FILE-PATH")
error = BarcodeReader.init_license("YOUR-LICENSE-KEY")
if error[0] != EnumErrorCode.DBR_OK:
    print(error[1])
dbr = BarcodeReader()
dbr.init_runtime_settings_with_string('{"Version":"3.0", "ImageParameter":{"Name":"high-density-qr-tpl","DeblurModes":[{"Mode":"DM_SHARPENING"},{"Mode":"DM_GRAY_EQUALIZATION"}],"ExpectedBarcodesCount":1,"LocalizationModes":[{"Mode":"LM_CONNECTED_BLOCKS"}],"ScaleUpModes": [{"Mode": "SUM_LINEAR_INTERPOLATION","AcuteAngleWithXThreshold": 0,"ModuleSizeThreshold": 4,"TargetModuleSize": 6}],"ScaleDownThreshold":10000,"Timeout":5000}}')
text_results = dbr.decode_file("YOUR-IMAGE-FILE-PATH")
# Add further process
BarcodeReader.initLicense("YOUR-LICENSE-KEY");
BarcodeReader reader = new BarcodeReader();
reader.initRuntimeSettingsWithString("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"high-density-qr-tpl\",\"DeblurModes\":[{\"Mode\":\"DM_SHARPENING\"},{\"Mode\":\"DM_GRAY_EQUALIZATION\"}],\"ExpectedBarcodesCount\":1,\"LocalizationModes\":[{\"Mode\":\"LM_CONNECTED_BLOCKS\"}],\"ScaleUpModes\": [{\"Mode\": \"SUM_LINEAR_INTERPOLATION\",\"AcuteAngleWithXThreshold\": 0,\"ModuleSizeThreshold\": 4,\"TargetModuleSize\": 6}],\"ScaleDownThreshold\":10000,\"Timeout\":5000}}}", EnumConflictMode.CM_OVERWRITE);
TextResult[] result = reader.decodeFile("YOUR-IMAGE-FILE-PATH", ""); // Start decoding
// Add further process
string errorMsg;
EnumErrorCode iRet = BarcodeReader.InitLicense("YOUR-LICENSE-KEY", out errorMsg);
if (iRet != EnumErrorCode.DBR_SUCCESS)
{
    Console.WriteLine(errorMsg);
}
BarcodeReader reader = new BarcodeReader();
reader.InitRuntimeSettingsWithString("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"high-density-qr-tpl\",\"DeblurModes\":[{\"Mode\":\"DM_SHARPENING\"},{\"Mode\":\"DM_GRAY_EQUALIZATION\"}],\"ExpectedBarcodesCount\":1,\"LocalizationModes\":[{\"Mode\":\"LM_CONNECTED_BLOCKS\"}],\"ScaleUpModes\": [{\"Mode\": \"SUM_LINEAR_INTERPOLATION\",\"AcuteAngleWithXThreshold\": 0,\"ModuleSizeThreshold\": 4,\"TargetModuleSize\": 6}],\"ScaleDownThreshold\":10000,\"Timeout\":5000}}}", EnumConflictMode.CM_OVERWRITE, out errorMsg);
TextResult[] result = reader.DecodeFile("YOUR-IMAGE-FILE-PATH", ""); // Start decoding
// Add further process
char errorBuf[512];
int iRet = -1;
iRet = dynamsoft::dbr::CBarcodeReader::InitLicense("YOUR-LICENSE-KEY", errorBuf, 512);
if (iRet != DBR_OK)
{
    cout << errorBuf << endl;
}
CBarcodeReader* reader = new CBarcodeReader();
reader->InitRuntimeSettingsWithString("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"high-density-qr-tpl\",\"DeblurModes\":[{\"Mode\":\"DM_SHARPENING\"},{\"Mode\":\"DM_GRAY_EQUALIZATION\"}],\"ExpectedBarcodesCount\":1,\"LocalizationModes\":[{\"Mode\":\"LM_CONNECTED_BLOCKS\"}],\"ScaleUpModes\": [{\"Mode\": \"SUM_LINEAR_INTERPOLATION\",\"AcuteAngleWithXThreshold\": 0,\"ModuleSizeThreshold\": 4,\"TargetModuleSize\": 6}],\"ScaleDownThreshold\":10000,\"Timeout\":5000}}}", CM_OVERWRITE, errorBuf, 512);
reader->DecodeFile("YOUR-IMAGE-FILE-PATH", ""); // Start decoding
// Add further process
int iRet = -1;
char errorBuf[512];
iRet = DBR_InitLicense("YOUR-LICENSE-KEY", errorBuf, 512);
if (iRet != DBR_OK)
{
    printf("%s\n", errorBuf);
}
void* barcodeReader = DBR_CreateInstance();
DBR_InitRuntimeSettingsWithString(barcodeReader, "{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"high-density-qr-tpl\",\"DeblurModes\":[{\"Mode\":\"DM_SHARPENING\"},{\"Mode\":\"DM_GRAY_EQUALIZATION\"}],\"ExpectedBarcodesCount\":1,\"LocalizationModes\":[{\"Mode\":\"LM_CONNECTED_BLOCKS\"}],\"ScaleUpModes\": [{\"Mode\": \"SUM_LINEAR_INTERPOLATION\",\"AcuteAngleWithXThreshold\": 0,\"ModuleSizeThreshold\": 4,\"TargetModuleSize\": 6}],\"ScaleDownThreshold\":10000,\"Timeout\":5000}}}", CM_OVERWRITE, errorBuf, 512);
DBR_DecodeFile(barcodeReader, "YOUR-IMAGE-FILE-PATH", ""); // Start decoding
// Add further process

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 +