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.
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
Sample Code
Below is an example illustrating how to configure the parameters to read density QR Codes.
-
update parameters in your JSON template
{ "CaptureVisionTemplates": [ { "Name": "CV_0", "ImageROIProcessingNameArray": ["TA_0" ], "Timeout":5000 } ], "TargetROIDefOptions" : [ { "Name": "TA_0", "TaskSettingNameArray": [ "BR_0" ] } ], "BarcodeReaderTaskSettingOptions": [ { "Name" : "BR_0", "BarcodeFormatIds" : ["BF_QR_CODE"], "ExpectedBarcodesCount" : 1, "SectionImageParameterArray": [ { "Section": "ST_REGION_PREDETECTION", "ImageParameterName": "IP_0" }, { "Section": "ST_BARCODE_LOCALIZATION", "ImageParameterName": "IP_0" }, { "Section": "ST_BARCODE_DECODING", "ImageParameterName": "IP_0" } ], "LocalizationModes":[ { "Mode": "LM_CONNECTED_BLOCKS" } ], "DeblurModes":[ { "Mode": "DM_SHARPENING" }, { "Mode": "DM_GRAY_EQUALIZATION" } ] } ], "ImageParameterOptions": [ { "Name": "IP_0", "ScaleDownThreshold": 10000, "ScaleUpModes": [ { "Mode": "SUM_LINEAR_INTERPOLATION", "AcuteAngleWithXThreshold": 0, "ModuleSizeThreshold": 4, "TargetModuleSize": 6 } ] } ] }
-
apply settings by calling method
InitSettingsFromFile
- JavaScript
- C++
- Android
- Objective-C
- Swift
// `router` is an instance of `CaptureVisionRouter`. // In the JS edition, the method name we use for initialization is different. router.initSettings("PATH-TO-YOUR-SETTING")
char szErrorMsg[256] = {0}; CCaptureVisionRouter* cvr = new CCaptureVisionRouter; cvr->InitSettingsFromFile("PATH-TO-YOUR-SETTING-FILE", szErrorMsg, 256); // more process here
try { // `cvr` is an instance of `CaptureVisionRouter`. cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE"); } catch (CaptureVisionRouterException e) { e.printStackTrace(); }
NSError *error; // `cvr` is an instance of `DSCaptureVisionRouter`. [self.cvr initSettingsFromFile:@"PATH-TO-YOUR-SETTING-FILE" error:&error];
do{ //`cvr` is an instance of `CaptureVisionRouter`. try cvr.initSettingsFromFile("PATH-TO-YOUR-SETTING-FILE") }catch{ // Add code to do when error occurs. }