Issue: Reading a small barcode within a large image can be challenging, especially when the barcode is slightly blurred, has small modules, or is affected by background interference. This makes it difficult for a barcode reader to accurately scan the code. In the example below, a 2 mm x 2 mm DataMatrix code is shown in an image where the camera cannot be positioned too close to the barcode.
Solution: The Dynamsoft Barcode Reader SDK offers flexible APIs, enabling developers to build a custom barcode scanner for various usage scenarios such as reading small barcodes at a distance. For this scenario, we recommend the following adjustments:
- Reduce the blocksize to minimize background interference during binarization and make the modules clearer.
- Set deblur to 9 to enhance clarity for slightly blurred codes.
- Enable ScaleUpModes to enlarge very small modules for improved readability.
JSON Template:
{
"ImageParameter" : {
"BinarizationModes": [
{
"BlockSizeX": 5,
"BlockSizeY": 5,
"EnableFillBinaryVacancy": 1,
"ImagePreprocessingModesIndex": -1,
"LibraryFileName": "",
"LibraryParameters": "",
"Mode": "BM_LOCAL_BLOCK",
"ThresholdCompensation": 5
}
],
"ScaleUpModes":["SUM_LINEAR_INTERPOLATION(0,4,6)"],
"DeblurLevel": 9,
"Name": "Settings"
},
"Version" : "3.0"
}
Binarized image produced by Dynamsoft Barcode Reader:
Template for Dynamsoft Barcode Reader:
JavaScript Code Snippet to Use the Template:
barcodeReader.initRuntimeSettingsWithString(template);
Read this case study to see how Naturalis ARISE, a scientific research consortium, achieved high accuracy and offline capability for reading tiny Data Matrix codes on specimen containers, even through plastic bags, test tubes, and liquids, in remote outdoor locations with the help of Dynamsoft Barcode Reader SDK.