Table of contents

How to Read Barcodes from an Image With Lots of Text

When trying to read an image where a barcode is surrounded by a large amount of irrelevant text, the presence of these characters may lead to incorrect positioning and slow down the execution speed. Dynamsoft Barcode Reader (DBR) provides parameter TextDetectionMode and IfEraseTextZone to control how to filter texts on an image.

Example

Below is an example illustrating how to configure the parameters to control text filtering function.

  • Update parameters in your JSON template

      {
          "CaptureVisionTemplates": [
              {
                  "Name": "CV_0",
                  "ImageROIProcessingNameArray": ["TA_0" ]
              }       
          ],
          "TargetROIDefOptions" : [
              {
                  "Name": "TA_0",
                  "TaskSettingNameArray": [ "BR_0" ]
              }
          ],
          "BarcodeReaderTaskSettingOptions": [
              {
                  "Name" : "BR_0",
                  "SectionImageParameterArray": [
                      {
                          "Section": "ST_REGION_PREDETECTION",
                          "ImageParameterName": "IP_0"
                      },
                      {
                          "Section": "ST_BARCODE_LOCALIZATION",
                          "ImageParameterName": "IP_0"
                      },
                      {
                          "Section": "ST_BARCODE_DECODING",
                          "ImageParameterName": "IP_0"
                      }
                  ]
              }
          ],
          "ImageParameterOptions": [
              {
                  "Name": "IP_0",
                  "TextDetectionMode":
                  {
                      "Mode": "TTDM_LINE",
                      "Direction": "UNKNOWN",
                      "CharHeightRange": [1, 100, 1],
                      "MaxSpacingInALine": -1,
                      "Sensitivity": 3
                  },
                  "IfEraseTextZone": 1
              }
          ]
      }
    
  • Apply the above settings following the article Use Templates for Configuring Parameters.

This page is compatible for:

Is this page helpful?

YesYes NoNo