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 sample image, a 2 mm x 2 mm DataMatrix code is shown 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 DeblurModes to null to let the program decide which deblur algorithms to use to enhance clarity for slightly blurred codes. Enable BarcodeScaleModes to enlarge very small modules for improved readability. { "BarcodeReaderTaskSettingOptions": [ { "BarcodeFormatIds": [ "BF_DEFAULT" ], "BarcodeFormatSpecificationNameArray": null, "BaseBarcodeReaderTaskSettingName": "", "DPMCodeReadingModes": [ { "BarcodeFormat": "BF_DATAMATRIX", "Mode": "DPMCRM_SKIP" } ], "ExpectedBarcodesCount": 0, "MaxThreadsInOneTask": 4, "Name": "BR_1", "SectionArray": [ { "ImageParameterName": "IP_1", "Section": "ST_REGION_PREDETECTION", "StageArray": [ { "RegionPredetectionModes": [ { "AspectRatioRange": "", "DetectionModelName": "", "FindAccurateBoundary": 0, "ForeAndBackgroundColours": "", "HeightRange": "", "MeasuredByPercentage": 1, "MinImageDimension": 262144, "Mode": "RPM_GENERAL", "RelativeRegions": "", "Sensitivity": 1, "SpatialIndexBlockSize": 5, "WidthRange": "" } ], "Stage": "SST_PREDETECT_REGIONS" } ] }, { "ImageParameterName": "IP_1", "Section": "ST_BARCODE_LOCALIZATION", "StageArray": [ { "LocalizationModes": [ { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_CONNECTED_BLOCKS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_SCAN_DIRECTLY", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_STATISTICS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_LINES", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 } ], "Stage": "SST_LOCALIZE_CANDIDATE_BARCODES" }, { "Stage": "SST_LOCALIZE_BARCODES" } ] }, { "ImageParameterName": "IP_Decode", "Section": "ST_BARCODE_DECODING", "StageArray": [ { "DeformationResistingModes": [ { "BinarizationMode": { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 }, "GrayscaleEnhancementMode": { "Mode": "GEM_AUTO", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, "Level": 5, "Mode": "DRM_SKIP" } ], "Stage": "SST_RESIST_DEFORMATION" }, { "BarcodeComplementModes": [ { "Mode": "BCM_SKIP" } ], "Stage": "SST_COMPLEMENT_BARCODE" }, { "BarcodeScaleModes": [ { "AcuteAngleWithXThreshold": -1, "Mode": "BSM_AUTO", "ModuleSizeThreshold": 0, "TargetModuleSize": 0 } ], "Stage": "SST_SCALE_BARCODE_IMAGE" }, { "DeblurModes": null, "ReturnBarcodeZoneClarity": 0, "Stage": "SST_DECODE_BARCODES" } ] } ], "TextResultOrderModes": [ { "Mode": "TROM_CONFIDENCE" }, { "Mode": "TROM_POSITION" }, { "Mode": "TROM_FORMAT" } ] } ], "CaptureVisionTemplates": [ { "ImageROIProcessingNameArray": [ "roi_default" ], "ImageSourceName": "", "MaxParallelTasks": 4, "MinImageCaptureInterval": 0, "Name": "Default_1", "OutputOriginalImage": 0, "SemanticProcessingNameArray": null, "Timeout": 10000 } ], "ErrorMessage": "successful.", "GlobalParameter": { "MaxTotalImageDimension": 0 }, "ImageParameterOptions": [ { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 2300, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 5, "BlockSizeY": 5, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 5 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_1" }, { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 99999, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_Decode" } ], "TargetROIDefOptions": [ { "BaseTargetROIDefName": "", "EnableResultsDeduplication": 1, "Location": { "Offset": { "FirstPoint": [ 0, 0, 1, 1 ], "FourthPoint": [ 0, 100, 1, 1 ], "MeasuredByPercentage": 1, "ReferenceObjectOriginIndex": 0, "ReferenceObjectType": "ROT_ATOMIC_OBJECT", "ReferenceXAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 0, "LengthReference": "LR_X", "RotationAngle": 90 }, "ReferenceYAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 1, "LengthReference": "LR_Y", "RotationAngle": 90 }, "SecondPoint": [ 100, 0, 1, 1 ], "ThirdPoint": [ 100, 100, 1, 1 ] }, "ReferenceObjectFilter": null }, "Name": "roi_default", "PauseFlag": 0, "TaskSettingNameArray": [ "BR_1" ] } ] } 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.
Decode Unreadable Barcodes with Custom Scan Parameters
Our advanced algorithms and image enhancement techniques are designed to efficiently handle unreadable barcodes resulting from damage, fading, or poor printing. By intelligently analyzing the barcode's structure and patterns, Dynamsoft Barcode Reader significantly improves barcode readability, ensuring seamless and accurate data capture.
Explore the real-world examples below to see how Dynamsoft can boost your scanning performance and tackle the challenges of difficult-to-read barcodes.
Tiny Inverted Glared DotCode
Issue: Reading the dot code on a cigarette package can be challenging due to several factors. Firstly, the small size of the code makes it difficult to detect. Additionally, the plastic wrapping on the package creates glare, further complicating the scanning process. The code is often printed in white on a black background, resulting in an inverted appearance. Moreover, the absence of a clear finder pattern hinders the accurate localization of 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 tiny inverted and glared DotCode. For this scenario, we recommend the following adjustments: Set BinarizationModes to BM_LOCAL_BLOCK to perform adaptive binarization by blocks, effectively reducing the impact of uneven lighting and small module sizes. Set LocalizationModes to LM_STATISTICS_MARKS to localize barcodes by grouping marks specifically designed for DotCode. Configure DeblurModes appropriately to enhance and sharpen blurry images. Set GrayscaleTransformationModes to invert the image, enabling the accurate reading of light barcodes on a dark background. { "BarcodeFormatSpecificationOptions": [ { "AllModuleDeviation": 0, "AustralianPostEncodingTable": "C", "BarcodeAngleRangeArray": null, "BarcodeBytesLengthRangeArray": null, "BarcodeComplementModes": null, "BarcodeFormatIds": [ "BF_DOTCODE" ], "BarcodeHeightRangeArray": null, "BarcodeTextLengthRangeArray": null, "BarcodeTextRegExPattern": "", "BarcodeWidthRangeArray": null, "BarcodeZoneBarCountRangeArray": null, "BarcodeZoneMinDistanceToImageBorders": 0, "BaseBarcodeFormatSpecification": "", "Code128Subset": "", "DataMatrixModuleIsotropic": 1, "DataMatrixSizeOptions": [ "DMS_DEFAULT" ], "DeformationResistingModes": null, "EnableAddOnCode": 0, "EnableDataMatrixECC000-140": 0, "EnableQRCodeModel1": 0, "FindUnevenModuleBarcode": 1, "HeadModuleRatio": "", "MSICodeCheckDigitCalculation": "MSICCDC_MOD_10", "MinQuietZoneWidth": 4, "MinRatioOfBarcodeZoneWidthToHeight": 0, "MinResultConfidence": 30, "MirrorMode": "MM_BOTH", "ModuleSizeRangeArray": null, "Name": "format_specification_read_dotcode", "PartitionModes": [ "PM_WHOLE_BARCODE", "PM_ALIGNMENT_PARTITION" ], "PatchCodeSearchingMargins": { "Bottom": 20, "Left": 20, "MeasuredByPercentage": 1, "Right": 20, "Top": 20 }, "RequireStartStopChars": 1, "ReturnPartialBarcodeValue": 1, "StandardFormat": "", "TailModuleRatio": "", "VerifyCheckDigit": 0 } ], "BarcodeReaderTaskSettingOptions": [ { "BarcodeFormatIds": [ "BF_DOTCODE" ], "BarcodeFormatSpecificationNameArray": [ "format_specification_read_dotcode" ], "BaseBarcodeReaderTaskSettingName": "", "DPMCodeReadingModes": [ { "BarcodeFormat": "BF_DATAMATRIX", "Mode": "DPMCRM_SKIP" } ], "ExpectedBarcodesCount": 1, "MaxThreadsInOneTask": 4, "Name": "task_read_dotcode", "SectionArray": [ { "ImageParameterName": "ip_read_dotcode", "Section": "ST_REGION_PREDETECTION", "StageArray": [ { "RegionPredetectionModes": [ { "AspectRatioRange": "", "DetectionModelName": "", "FindAccurateBoundary": 0, "ForeAndBackgroundColours": "", "HeightRange": "", "MeasuredByPercentage": 1, "MinImageDimension": 262144, "Mode": "RPM_GENERAL", "RelativeRegions": "", "Sensitivity": 1, "SpatialIndexBlockSize": 5, "WidthRange": "" } ], "Stage": "SST_PREDETECT_REGIONS" } ] }, { "ImageParameterName": "ip_read_dotcode", "Section": "ST_BARCODE_LOCALIZATION", "StageArray": [ { "LocalizationModes": [ { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_STATISTICS_MARKS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 } ], "Stage": "SST_LOCALIZE_CANDIDATE_BARCODES" }, { "Stage": "SST_LOCALIZE_BARCODES" } ] }, { "ImageParameterName": "ip_read_dotcode", "Section": "ST_BARCODE_DECODING", "StageArray": [ { "DeformationResistingModes": [ { "BinarizationMode": { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 }, "GrayscaleEnhancementMode": { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, "Level": 5, "Mode": "DRM_SKIP" } ], "Stage": "SST_RESIST_DEFORMATION" }, { "BarcodeComplementModes": [ { "Mode": "BCM_SKIP" } ], "Stage": "SST_COMPLEMENT_BARCODE" }, { "BarcodeScaleModes": [ { "AcuteAngleWithXThreshold": -1, "Mode": "BSM_AUTO", "ModuleSizeThreshold": 0, "TargetModuleSize": 0 } ], "Stage": "SST_SCALE_BARCODE_IMAGE" }, { "DeblurModes": [ { "DeblurModelNames": null, "Level": 4, "Mode": "DM_BASED_ON_LOC_BIN" }, { "DeblurModelNames": null, "Level": 4, "Mode": "DM_THRESHOLD_BINARIZATION" }, { "DeblurModelNames": null, "Level": 4, "Mode": "DM_DEEP_ANALYSIS" } ], "ReturnBarcodeZoneClarity": 0, "Stage": "SST_DECODE_BARCODES" } ] } ], "TextResultOrderModes": [ { "Mode": "TROM_CONFIDENCE" }, { "Mode": "TROM_POSITION" }, { "Mode": "TROM_FORMAT" } ] } ], "CaptureVisionTemplates": [ { "ImageROIProcessingNameArray": [ "roi_read_dotcode" ], "ImageSourceName": "", "MaxParallelTasks": 0, "MinImageCaptureInterval": 0, "Name": "Default_1", "OutputOriginalImage": 0, "SemanticProcessingNameArray": null, "Timeout": 700 } ], "ErrorMessage": "successful.", "GlobalParameter": { "MaxTotalImageDimension": 0 }, "ImageParameterOptions": [ { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 2300, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_INVERTED" }, { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 15, "BlockSizeY": 15, "EnableFillBinaryVacancy": 0, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 }, { "BinarizationThreshold": -1, "BlockSizeX": 21, "BlockSizeY": 21, "EnableFillBinaryVacancy": 0, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "Erode", "MorphOperationKernelSizeX": 3, "MorphOperationKernelSizeY": 3, "MorphShape": "Ellipse", "ThresholdCompensation": 10 }, { "BinarizationThreshold": -1, "BlockSizeX": 35, "BlockSizeY": 35, "EnableFillBinaryVacancy": 0, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "Erode", "MorphOperationKernelSizeX": 3, "MorphOperationKernelSizeY": 3, "MorphShape": "Ellipse", "ThresholdCompensation": 10 }, { "BinarizationThreshold": -1, "BlockSizeX": 45, "BlockSizeY": 45, "EnableFillBinaryVacancy": 0, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "Erode", "MorphOperationKernelSizeX": 3, "MorphOperationKernelSizeY": 3, "MorphShape": "Ellipse", "ThresholdCompensation": 25 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "ip_read_dotcode" } ], "TargetROIDefOptions": [ { "BaseTargetROIDefName": "", "EnableResultsDeduplication": 1, "Location": { "Offset": { "FirstPoint": [ 0, 0, 1, 1 ], "FourthPoint": [ 0, 100, 1, 1 ], "MeasuredByPercentage": 1, "ReferenceObjectOriginIndex": 0, "ReferenceObjectType": "ROT_ATOMIC_OBJECT", "ReferenceXAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 0, "LengthReference": "LR_X", "RotationAngle": 90 }, "ReferenceYAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 1, "LengthReference": "LR_Y", "RotationAngle": 90 }, "SecondPoint": [ 100, 0, 1, 1 ], "ThirdPoint": [ 100, 100, 1, 1 ] }, "ReferenceObjectFilter": null }, "Name": "roi_read_dotcode", "PauseFlag": 0, "TaskSettingNameArray": [ "task_read_dotcode" ] } ] }
QR code with Shadow
Issue: It’s very common that an image taken may present some shadows. The barcode area with uneven lighting is a very challenging decoding situation that many scanners fail to read. Solution: Dynamsoft Barcode Reader provides an adaptive binarization mode (BM_LOCAL_BLOCK) which caters to different lighting areas in the image in order to successfully decode these challenging barcodes. Image Source: https://boofcv.org/index.php?title=Performance:QrCode { "BarcodeReaderTaskSettingOptions": [ { "BarcodeFormatIds": [ "BF_DEFAULT" ], "BarcodeFormatSpecificationNameArray": null, "BaseBarcodeReaderTaskSettingName": "", "DPMCodeReadingModes": [ { "BarcodeFormat": "BF_DATAMATRIX", "Mode": "DPMCRM_SKIP" } ], "ExpectedBarcodesCount": 0, "MaxThreadsInOneTask": 4, "Name": "BR_1", "SectionArray": [ { "ImageParameterName": "IP_1", "Section": "ST_REGION_PREDETECTION", "StageArray": [ { "RegionPredetectionModes": [ { "AspectRatioRange": "", "DetectionModelName": "", "FindAccurateBoundary": 0, "ForeAndBackgroundColours": "", "HeightRange": "", "MeasuredByPercentage": 1, "MinImageDimension": 262144, "Mode": "RPM_GENERAL", "RelativeRegions": "", "Sensitivity": 1, "SpatialIndexBlockSize": 5, "WidthRange": "" } ], "Stage": "SST_PREDETECT_REGIONS" } ] }, { "ImageParameterName": "IP_1", "Section": "ST_BARCODE_LOCALIZATION", "StageArray": [ { "LocalizationModes": [ { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_CONNECTED_BLOCKS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_SCAN_DIRECTLY", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_STATISTICS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_LINES", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 } ], "Stage": "SST_LOCALIZE_CANDIDATE_BARCODES" }, { "Stage": "SST_LOCALIZE_BARCODES" } ] }, { "ImageParameterName": "IP_Decode", "Section": "ST_BARCODE_DECODING", "StageArray": [ { "DeformationResistingModes": [ { "BinarizationMode": { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 }, "GrayscaleEnhancementMode": { "Mode": "GEM_AUTO", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, "Level": 5, "Mode": "DRM_SKIP" } ], "Stage": "SST_RESIST_DEFORMATION" }, { "BarcodeComplementModes": [ { "Mode": "BCM_SKIP" } ], "Stage": "SST_COMPLEMENT_BARCODE" }, { "BarcodeScaleModes": [ { "AcuteAngleWithXThreshold": -1, "Mode": "BSM_AUTO", "ModuleSizeThreshold": 0, "TargetModuleSize": 0 } ], "Stage": "SST_SCALE_BARCODE_IMAGE" }, { "DeblurModes": null, "ReturnBarcodeZoneClarity": 0, "Stage": "SST_DECODE_BARCODES" } ] } ], "TextResultOrderModes": [ { "Mode": "TROM_CONFIDENCE" }, { "Mode": "TROM_POSITION" }, { "Mode": "TROM_FORMAT" } ] } ], "CaptureVisionTemplates": [ { "ImageROIProcessingNameArray": [ "roi_default" ], "ImageSourceName": "", "MaxParallelTasks": 4, "MinImageCaptureInterval": 0, "Name": "Default_1", "OutputOriginalImage": 0, "SemanticProcessingNameArray": null, "Timeout": 10000 } ], "GlobalParameter": { "MaxTotalImageDimension": 0 }, "ImageParameterOptions": [ { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 2300, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_1" }, { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 99999, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_Decode" } ], "TargetROIDefOptions": [ { "BaseTargetROIDefName": "", "EnableResultsDeduplication": 1, "Location": { "Offset": { "FirstPoint": [ 0, 0, 1, 1 ], "FourthPoint": [ 0, 100, 1, 1 ], "MeasuredByPercentage": 1, "ReferenceObjectOriginIndex": 0, "ReferenceObjectType": "ROT_ATOMIC_OBJECT", "ReferenceXAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 0, "LengthReference": "LR_X", "RotationAngle": 90 }, "ReferenceYAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 1, "LengthReference": "LR_Y", "RotationAngle": 90 }, "SecondPoint": [ 100, 0, 1, 1 ], "ThirdPoint": [ 100, 100, 1, 1 ] }, "ReferenceObjectFilter": null }, "Name": "roi_default", "PauseFlag": 0, "TaskSettingNameArray": [ "BR_1" ] } ] }
Barcodes in Low Light
Issue: In low light, the barcodes may have a low quality. The image contains noise and it is difficult to differentiate the barcodes from the background due to the low contrast. Solution: Dynamsoft Barcode Reader provides an adaptive binarization mode (BM_LOCAL_BLOCK). We can configure different block sizes to keep the barcode details in low light after binarization. { "BarcodeReaderTaskSettingOptions": [ { "BarcodeFormatIds": [ "BF_DEFAULT", "BF_PATCHCODE" ], "BarcodeFormatSpecificationNameArray": null, "BaseBarcodeReaderTaskSettingName": "", "DPMCodeReadingModes": [ { "BarcodeFormat": "BF_DATAMATRIX", "Mode": "DPMCRM_SKIP" } ], "ExpectedBarcodesCount": 999, "MaxThreadsInOneTask": 4, "Name": "BR_1", "SectionArray": [ { "ImageParameterName": "IP_1", "Section": "ST_REGION_PREDETECTION", "StageArray": [ { "RegionPredetectionModes": [ { "AspectRatioRange": "", "DetectionModelName": "", "FindAccurateBoundary": 0, "ForeAndBackgroundColours": "", "HeightRange": "", "MeasuredByPercentage": 1, "MinImageDimension": 262144, "Mode": "RPM_GENERAL", "RelativeRegions": "", "Sensitivity": 1, "SpatialIndexBlockSize": 5, "WidthRange": "" } ], "Stage": "SST_PREDETECT_REGIONS" } ] }, { "ImageParameterName": "IP_1", "Section": "ST_BARCODE_LOCALIZATION", "StageArray": [ { "LocalizationModes": [ { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_CONNECTED_BLOCKS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_SCAN_DIRECTLY", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_STATISTICS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_LINES", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 } ], "Stage": "SST_LOCALIZE_CANDIDATE_BARCODES" }, { "Stage": "SST_LOCALIZE_BARCODES" } ] }, { "ImageParameterName": "IP_Decode", "Section": "ST_BARCODE_DECODING", "StageArray": [ { "DeformationResistingModes": [ { "BinarizationMode": { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 }, "GrayscaleEnhancementMode": { "Mode": "GEM_AUTO", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, "Level": 5, "Mode": "DRM_SKIP" } ], "Stage": "SST_RESIST_DEFORMATION" }, { "BarcodeComplementModes": [ { "Mode": "BCM_SKIP" } ], "Stage": "SST_COMPLEMENT_BARCODE" }, { "BarcodeScaleModes": [ { "AcuteAngleWithXThreshold": -1, "Mode": "BSM_AUTO", "ModuleSizeThreshold": 0, "TargetModuleSize": 0 } ], "Stage": "SST_SCALE_BARCODE_IMAGE" }, { "DeblurModes": null, "ReturnBarcodeZoneClarity": 0, "Stage": "SST_DECODE_BARCODES" } ] } ], "TextResultOrderModes": [ { "Mode": "TROM_CONFIDENCE" }, { "Mode": "TROM_POSITION" }, { "Mode": "TROM_FORMAT" } ] } ], "CaptureVisionTemplates": [ { "ImageROIProcessingNameArray": [ "roi_default" ], "ImageSourceName": "", "MaxParallelTasks": 4, "MinImageCaptureInterval": 0, "Name": "Default_1", "OutputOriginalImage": 0, "SemanticProcessingNameArray": null, "Timeout": 99999 } ], "ErrorMessage": "successful.", "GlobalParameter": { "MaxTotalImageDimension": 0 }, "ImageParameterOptions": [ { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 2300, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, { "Mode": "GEM_GRAY_EQUALIZE", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, { "Mode": "GEM_GRAY_SMOOTH", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_1" }, { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 99999, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_Decode" } ], "TargetROIDefOptions": [ { "BaseTargetROIDefName": "", "EnableResultsDeduplication": 1, "Location": { "Offset": { "FirstPoint": [ 0, 0, 1, 1 ], "FourthPoint": [ 0, 100, 1, 1 ], "MeasuredByPercentage": 1, "ReferenceObjectOriginIndex": 0, "ReferenceObjectType": "ROT_ATOMIC_OBJECT", "ReferenceXAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 0, "LengthReference": "LR_X", "RotationAngle": 90 }, "ReferenceYAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 1, "LengthReference": "LR_Y", "RotationAngle": 90 }, "SecondPoint": [ 100, 0, 1, 1 ], "ThirdPoint": [ 100, 100, 1, 1 ] }, "ReferenceObjectFilter": null }, "Name": "roi_default", "PauseFlag": 0, "TaskSettingNameArray": [ "BR_1" ] } ] }
Barcodes in Strong Light
Issue: In strong light, the barcodes may be overexposed. The bars become difficult to read. Solution: Dynamsoft Barcode Reader provides an adaptive binarization mode (BM_LOCAL_BLOCK). We can configure different block sizes to keep the barcode details in strong light after binarization. { "BarcodeFormatSpecificationOptions": [ { "AllModuleDeviation": 0, "AustralianPostEncodingTable": "C", "BarcodeAngleRangeArray": null, "BarcodeBytesLengthRangeArray": null, "BarcodeComplementModes": null, "BarcodeFormatIds": [ "BF_PDF417", "BF_QR_CODE", "BF_DATAMATRIX", "BF_AZTEC", "BF_MICRO_QR", "BF_MICRO_PDF417", "BF_DOTCODE" ], "BarcodeHeightRangeArray": null, "BarcodeTextLengthRangeArray": null, "BarcodeTextRegExPattern": "", "BarcodeWidthRangeArray": null, "BarcodeZoneBarCountRangeArray": null, "BarcodeZoneMinDistanceToImageBorders": 0, "BaseBarcodeFormatSpecification": "", "Code128Subset": "", "DataMatrixModuleIsotropic": 1, "DataMatrixSizeOptions": [ "DMS_DEFAULT" ], "DeformationResistingModes": null, "EnableAddOnCode": 0, "EnableDataMatrixECC000-140": 0, "EnableQRCodeModel1": 0, "FindUnevenModuleBarcode": 1, "HeadModuleRatio": "", "MSICodeCheckDigitCalculation": "MSICCDC_MOD_10", "MinQuietZoneWidth": 4, "MinRatioOfBarcodeZoneWidthToHeight": 0, "MinResultConfidence": 30, "MirrorMode": "MM_BOTH", "ModuleSizeRangeArray": null, "Name": "bfs1", "PartitionModes": [ "PM_WHOLE_BARCODE", "PM_ALIGNMENT_PARTITION" ], "PatchCodeSearchingMargins": { "Bottom": 20, "Left": 20, "MeasuredByPercentage": 1, "Right": 20, "Top": 20 }, "RequireStartStopChars": 1, "ReturnPartialBarcodeValue": 1, "StandardFormat": "", "TailModuleRatio": "", "VerifyCheckDigit": 0 }, { "AllModuleDeviation": 0, "AustralianPostEncodingTable": "C", "BarcodeAngleRangeArray": null, "BarcodeBytesLengthRangeArray": null, "BarcodeComplementModes": null, "BarcodeFormatIds": [ "BF_ALL" ], "BarcodeHeightRangeArray": null, "BarcodeTextLengthRangeArray": null, "BarcodeTextRegExPattern": "", "BarcodeWidthRangeArray": null, "BarcodeZoneBarCountRangeArray": null, "BarcodeZoneMinDistanceToImageBorders": 0, "BaseBarcodeFormatSpecification": "", "Code128Subset": "", "DataMatrixModuleIsotropic": 1, "DataMatrixSizeOptions": [ "DMS_DEFAULT" ], "DeformationResistingModes": null, "EnableAddOnCode": 0, "EnableDataMatrixECC000-140": 0, "EnableQRCodeModel1": 0, "FindUnevenModuleBarcode": 1, "HeadModuleRatio": "", "MSICodeCheckDigitCalculation": "MSICCDC_MOD_10", "MinQuietZoneWidth": 4, "MinRatioOfBarcodeZoneWidthToHeight": 0, "MinResultConfidence": 30, "MirrorMode": "MM_NORMAL", "ModuleSizeRangeArray": null, "Name": "bfs2", "PartitionModes": [ "PM_WHOLE_BARCODE", "PM_ALIGNMENT_PARTITION" ], "PatchCodeSearchingMargins": { "Bottom": 20, "Left": 20, "MeasuredByPercentage": 1, "Right": 20, "Top": 20 }, "RequireStartStopChars": 1, "ReturnPartialBarcodeValue": 1, "StandardFormat": "", "TailModuleRatio": "", "VerifyCheckDigit": 0 } ], "BarcodeReaderTaskSettingOptions": [ { "BarcodeFormatIds": [ "BF_ONED", "BF_PDF417", "BF_QR_CODE", "BF_DATAMATRIX", "BF_MICRO_QR", "BF_MICRO_PDF417" ], "BarcodeFormatSpecificationNameArray": [ "bfs1", "bfs2" ], "BaseBarcodeReaderTaskSettingName": "", "DPMCodeReadingModes": [ { "BarcodeFormat": "BF_DATAMATRIX", "Mode": "DPMCRM_SKIP" } ], "ExpectedBarcodesCount": 999, "MaxThreadsInOneTask": 4, "Name": "task-read-barcodes", "SectionArray": [ { "ImageParameterName": "ip-read-barcodes", "Section": "ST_REGION_PREDETECTION", "StageArray": [ { "RegionPredetectionModes": [ { "AspectRatioRange": "", "DetectionModelName": "", "FindAccurateBoundary": 0, "ForeAndBackgroundColours": "", "HeightRange": "", "MeasuredByPercentage": 1, "MinImageDimension": 262144, "Mode": "RPM_GENERAL", "RelativeRegions": "", "Sensitivity": 1, "SpatialIndexBlockSize": 5, "WidthRange": "" } ], "Stage": "SST_PREDETECT_REGIONS" } ] }, { "ImageParameterName": "ip-read-barcodes", "Section": "ST_BARCODE_LOCALIZATION", "StageArray": [ { "LocalizationModes": [ { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_CONNECTED_BLOCKS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_SCAN_DIRECTLY", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_STATISTICS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_LINES", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 } ], "Stage": "SST_LOCALIZE_CANDIDATE_BARCODES" }, { "Stage": "SST_LOCALIZE_BARCODES" } ] }, { "ImageParameterName": "ip-read-barcodes", "Section": "ST_BARCODE_DECODING", "StageArray": [ { "DeformationResistingModes": [ { "BinarizationMode": { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 }, "GrayscaleEnhancementMode": { "Mode": "GEM_AUTO", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, "Level": 5, "Mode": "DRM_SKIP" } ], "Stage": "SST_RESIST_DEFORMATION" }, { "BarcodeComplementModes": [ { "Mode": "BCM_SKIP" } ], "Stage": "SST_COMPLEMENT_BARCODE" }, { "BarcodeScaleModes": [ { "AcuteAngleWithXThreshold": -1, "Mode": "BSM_AUTO", "ModuleSizeThreshold": 0, "TargetModuleSize": 0 } ], "Stage": "SST_SCALE_BARCODE_IMAGE" }, { "DeblurModes": null, "ReturnBarcodeZoneClarity": 0, "Stage": "SST_DECODE_BARCODES" } ] } ], "TextResultOrderModes": [ { "Mode": "TROM_CONFIDENCE" }, { "Mode": "TROM_POSITION" }, { "Mode": "TROM_FORMAT" } ] } ], "CaptureVisionTemplates": [ { "ImageROIProcessingNameArray": [ "roi-read-barcodes" ], "ImageSourceName": "", "MaxParallelTasks": 4, "MinImageCaptureInterval": 0, "Name": "Default_1", "OutputOriginalImage": 0, "SemanticProcessingNameArray": null, "Timeout": 10000 } ], "GlobalParameter": { "MaxTotalImageDimension": 0 }, "ImageParameterOptions": [ { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 2300, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" }, { "Mode": "GTM_INVERTED" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 }, { "BinarizationThreshold": -1, "BlockSizeX": 61, "BlockSizeY": 61, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 0 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "ip-read-barcodes" } ], "TargetROIDefOptions": [ { "BaseTargetROIDefName": "", "EnableResultsDeduplication": 1, "Location": { "Offset": { "FirstPoint": [ 0, 0, 1, 1 ], "FourthPoint": [ 0, 100, 1, 1 ], "MeasuredByPercentage": 1, "ReferenceObjectOriginIndex": 0, "ReferenceObjectType": "ROT_ATOMIC_OBJECT", "ReferenceXAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 0, "LengthReference": "LR_X", "RotationAngle": 90 }, "ReferenceYAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 1, "LengthReference": "LR_Y", "RotationAngle": 90 }, "SecondPoint": [ 100, 0, 1, 1 ], "ThirdPoint": [ 100, 100, 1, 1 ] }, "ReferenceObjectFilter": null }, "Name": "roi-read-barcodes", "PauseFlag": 0, "TaskSettingNameArray": [ "task-read-barcodes" ] } ] } Image Source: Muenster Barcode DB
Batch QR Codes
Issue: When it comes to scanning hundreds of barcodes in an image, Dynamsoft offers many optimization settings to effectively and quickly batch scan QR Codes. Solution: First, set the barcode type to QR code if your image only contains this type of code to reduce decoding time. Next, set the GrayscaleEnhancementModes to eliminate blurriness and set the ThresholdCompensation in BinarizationModes higher to improve the binary image with a dark background. Then, try different localization methods to accurately pinpoint the barcode locations. At last, set the ExpectedBarcodesCount to a large number such as 999 to make sure that the algorithm works really hard to decode as many barcodes as possible. { "BarcodeReaderTaskSettingOptions": [ { "BarcodeFormatIds": [ "BF_QR_CODE", "BF_MICRO_QR" ], "BarcodeFormatSpecificationNameArray": null, "BaseBarcodeReaderTaskSettingName": "", "DPMCodeReadingModes": [ { "BarcodeFormat": "BF_DATAMATRIX", "Mode": "DPMCRM_SKIP" } ], "ExpectedBarcodesCount": 999, "MaxThreadsInOneTask": 4, "Name": "BR_1", "SectionArray": [ { "ImageParameterName": "IP_1", "Section": "ST_REGION_PREDETECTION", "StageArray": [ { "RegionPredetectionModes": [ { "AspectRatioRange": "", "DetectionModelName": "", "FindAccurateBoundary": 0, "ForeAndBackgroundColours": "", "HeightRange": "", "MeasuredByPercentage": 1, "MinImageDimension": 262144, "Mode": "RPM_GENERAL", "RelativeRegions": "", "Sensitivity": 1, "SpatialIndexBlockSize": 5, "WidthRange": "" } ], "Stage": "SST_PREDETECT_REGIONS" } ] }, { "ImageParameterName": "IP_1", "Section": "ST_BARCODE_LOCALIZATION", "StageArray": [ { "LocalizationModes": [ { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_CONNECTED_BLOCKS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_SCAN_DIRECTLY", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_STATISTICS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_LINES", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 } ], "Stage": "SST_LOCALIZE_CANDIDATE_BARCODES" }, { "Stage": "SST_LOCALIZE_BARCODES" } ] }, { "ImageParameterName": "IP_Decode", "Section": "ST_BARCODE_DECODING", "StageArray": [ { "DeformationResistingModes": [ { "BinarizationMode": { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 }, "GrayscaleEnhancementMode": { "Mode": "GEM_AUTO", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, "Level": 5, "Mode": "DRM_SKIP" } ], "Stage": "SST_RESIST_DEFORMATION" }, { "BarcodeComplementModes": [ { "Mode": "BCM_SKIP" } ], "Stage": "SST_COMPLEMENT_BARCODE" }, { "BarcodeScaleModes": [ { "AcuteAngleWithXThreshold": -1, "Mode": "BSM_AUTO", "ModuleSizeThreshold": 0, "TargetModuleSize": 0 } ], "Stage": "SST_SCALE_BARCODE_IMAGE" }, { "DeblurModes": null, "ReturnBarcodeZoneClarity": 0, "Stage": "SST_DECODE_BARCODES" } ] } ], "TextResultOrderModes": [ { "Mode": "TROM_CONFIDENCE" }, { "Mode": "TROM_POSITION" }, { "Mode": "TROM_FORMAT" } ] } ], "CaptureVisionTemplates": [ { "ImageROIProcessingNameArray": [ "roi_default" ], "ImageSourceName": "", "MaxParallelTasks": 4, "MinImageCaptureInterval": 0, "Name": "Default_1", "OutputOriginalImage": 0, "SemanticProcessingNameArray": null, "Timeout": 10000 } ], "GlobalParameter": { "MaxTotalImageDimension": 0 }, "ImageParameterOptions": [ { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 2300, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, { "Mode": "GEM_GRAY_EQUALIZE", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, { "Mode": "GEM_GRAY_SMOOTH", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 20 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_1" }, { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 99999, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_Decode" } ], "TargetROIDefOptions": [ { "BaseTargetROIDefName": "", "EnableResultsDeduplication": 1, "Location": { "Offset": { "FirstPoint": [ 0, 0, 1, 1 ], "FourthPoint": [ 0, 100, 1, 1 ], "MeasuredByPercentage": 1, "ReferenceObjectOriginIndex": 0, "ReferenceObjectType": "ROT_ATOMIC_OBJECT", "ReferenceXAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 0, "LengthReference": "LR_X", "RotationAngle": 90 }, "ReferenceYAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 1, "LengthReference": "LR_Y", "RotationAngle": 90 }, "SecondPoint": [ 100, 0, 1, 1 ], "ThirdPoint": [ 100, 100, 1, 1 ] }, "ReferenceObjectFilter": null }, "Name": "roi_default", "PauseFlag": 0, "TaskSettingNameArray": [ "BR_1" ] } ] }
Blurry Barcodes
Issue: Blurry QR codes and barcodes pose a significant challenge to effective scanning. The images of the codes may be taken in low resolution or motion. Solution: There are some parameters we can adjust to improve the reading rate. Set DeblurModes to null to let the program decide which deblur algorithms to use to read blurred barcodes. Set the ExpectedBarcodesCount to a higher value like 999 so that it will try all the available image processing methods. Set GrayscaleEnhancementModes to enhance the image. Set BarcodeScaleModes to scale up modules if their size is too small. { "BarcodeReaderTaskSettingOptions": [ { "BarcodeFormatIds": [ "BF_DEFAULT", "BF_PATCHCODE" ], "BarcodeFormatSpecificationNameArray": null, "BaseBarcodeReaderTaskSettingName": "", "DPMCodeReadingModes": [ { "BarcodeFormat": "BF_DATAMATRIX", "Mode": "DPMCRM_SKIP" } ], "ExpectedBarcodesCount": 999, "MaxThreadsInOneTask": 4, "Name": "BR_1", "SectionArray": [ { "ImageParameterName": "IP_1", "Section": "ST_REGION_PREDETECTION", "StageArray": [ { "RegionPredetectionModes": [ { "AspectRatioRange": "", "DetectionModelName": "", "FindAccurateBoundary": 0, "ForeAndBackgroundColours": "", "HeightRange": "", "MeasuredByPercentage": 1, "MinImageDimension": 262144, "Mode": "RPM_GENERAL", "RelativeRegions": "", "Sensitivity": 1, "SpatialIndexBlockSize": 5, "WidthRange": "" } ], "Stage": "SST_PREDETECT_REGIONS" } ] }, { "ImageParameterName": "IP_1", "Section": "ST_BARCODE_LOCALIZATION", "StageArray": [ { "LocalizationModes": [ { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_CONNECTED_BLOCKS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_SCAN_DIRECTLY", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_STATISTICS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_LINES", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 } ], "Stage": "SST_LOCALIZE_CANDIDATE_BARCODES" }, { "Stage": "SST_LOCALIZE_BARCODES" } ] }, { "ImageParameterName": "IP_Decode", "Section": "ST_BARCODE_DECODING", "StageArray": [ { "DeformationResistingModes": [ { "BinarizationMode": { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 }, "GrayscaleEnhancementMode": { "Mode": "GEM_AUTO", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, "Level": 5, "Mode": "DRM_SKIP" } ], "Stage": "SST_RESIST_DEFORMATION" }, { "BarcodeComplementModes": [ { "Mode": "BCM_SKIP" } ], "Stage": "SST_COMPLEMENT_BARCODE" }, { "BarcodeScaleModes": [ { "AcuteAngleWithXThreshold": -1, "Mode": "BSM_AUTO", "ModuleSizeThreshold": 0, "TargetModuleSize": 0 } ], "Stage": "SST_SCALE_BARCODE_IMAGE" }, { "DeblurModes": null, "ReturnBarcodeZoneClarity": 0, "Stage": "SST_DECODE_BARCODES" } ] } ], "TextResultOrderModes": [ { "Mode": "TROM_CONFIDENCE" }, { "Mode": "TROM_POSITION" }, { "Mode": "TROM_FORMAT" } ] } ], "CaptureVisionTemplates": [ { "ImageROIProcessingNameArray": [ "roi_default" ], "ImageSourceName": "", "MaxParallelTasks": 4, "MinImageCaptureInterval": 0, "Name": "Default_1", "OutputOriginalImage": 0, "SemanticProcessingNameArray": null, "Timeout": 99999 } ], "ErrorMessage": "successful.", "GlobalParameter": { "MaxTotalImageDimension": 0 }, "ImageParameterOptions": [ { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 2300, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, { "Mode": "GEM_GRAY_EQUALIZE", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, { "Mode": "GEM_GRAY_SMOOTH", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_1" }, { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 99999, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_Decode" } ], "TargetROIDefOptions": [ { "BaseTargetROIDefName": "", "EnableResultsDeduplication": 1, "Location": { "Offset": { "FirstPoint": [ 0, 0, 1, 1 ], "FourthPoint": [ 0, 100, 1, 1 ], "MeasuredByPercentage": 1, "ReferenceObjectOriginIndex": 0, "ReferenceObjectType": "ROT_ATOMIC_OBJECT", "ReferenceXAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 0, "LengthReference": "LR_X", "RotationAngle": 90 }, "ReferenceYAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 1, "LengthReference": "LR_Y", "RotationAngle": 90 }, "SecondPoint": [ 100, 0, 1, 1 ], "ThirdPoint": [ 100, 100, 1, 1 ] }, "ReferenceObjectFilter": null }, "Name": "roi_default", "PauseFlag": 0, "TaskSettingNameArray": [ "BR_1" ] } ] } Image Source: https://boofcv.org/index.php?title=Performance:QrCode
Crumpled Barcodes
Issue: Barcodes rely on precise spacing and width ratios between black bars and white spaces to encode data. When a barcode is crumpled, the bars may become stretched, compressed, or skewed, altering their intended proportions. Solution: Dynamsoft Barcode Reader SDK provides several DeformationResistingModes to overcome deformation. { "BarcodeReaderTaskSettingOptions": [ { "BarcodeFormatIds": [ "BF_DEFAULT" ], "BarcodeFormatSpecificationNameArray": null, "BaseBarcodeReaderTaskSettingName": "", "DPMCodeReadingModes": [ { "BarcodeFormat": "BF_DATAMATRIX", "Mode": "DPMCRM_SKIP" } ], "ExpectedBarcodesCount": 0, "MaxThreadsInOneTask": 4, "Name": "BR_1", "SectionArray": [ { "ImageParameterName": "IP_1", "Section": "ST_REGION_PREDETECTION", "StageArray": [ { "RegionPredetectionModes": [ { "AspectRatioRange": "", "DetectionModelName": "", "FindAccurateBoundary": 0, "ForeAndBackgroundColours": "", "HeightRange": "", "MeasuredByPercentage": 1, "MinImageDimension": 262144, "Mode": "RPM_GENERAL", "RelativeRegions": "", "Sensitivity": 1, "SpatialIndexBlockSize": 5, "WidthRange": "" } ], "Stage": "SST_PREDETECT_REGIONS" } ] }, { "ImageParameterName": "IP_1", "Section": "ST_BARCODE_LOCALIZATION", "StageArray": [ { "LocalizationModes": [ { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_CONNECTED_BLOCKS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_SCAN_DIRECTLY", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_STATISTICS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_LINES", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 } ], "Stage": "SST_LOCALIZE_CANDIDATE_BARCODES" }, { "Stage": "SST_LOCALIZE_BARCODES" } ] }, { "ImageParameterName": "IP_Decode", "Section": "ST_BARCODE_DECODING", "StageArray": [ { "DeformationResistingModes": [ { "BinarizationMode": { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 }, "GrayscaleEnhancementMode": { "Mode": "GEM_AUTO", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, "Level": 5, "Mode": "DRM_GENERAL" }, { "BinarizationMode": { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 }, "GrayscaleEnhancementMode": { "Mode": "GEM_AUTO", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, "Level": 5, "Mode": "DRM_BROAD_WARP" }, { "BinarizationMode": { "BinarizationThreshold": -1, "BlockSizeX": 30, "BlockSizeY": 30, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 }, "GrayscaleEnhancementMode": { "Mode": "GEM_AUTO", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, "Level": 5, "Mode": "DRM_DEWRINKLE" } ], "Stage": "SST_RESIST_DEFORMATION" }, { "BarcodeComplementModes": [ { "Mode": "BCM_SKIP" } ], "Stage": "SST_COMPLEMENT_BARCODE" }, { "BarcodeScaleModes": [ { "AcuteAngleWithXThreshold": -1, "Mode": "BSM_AUTO", "ModuleSizeThreshold": 0, "TargetModuleSize": 0 } ], "Stage": "SST_SCALE_BARCODE_IMAGE" }, { "DeblurModes": null, "ReturnBarcodeZoneClarity": 0, "Stage": "SST_DECODE_BARCODES" } ] } ], "TextResultOrderModes": [ { "Mode": "TROM_CONFIDENCE" }, { "Mode": "TROM_POSITION" }, { "Mode": "TROM_FORMAT" } ] } ], "CaptureVisionTemplates": [ { "ImageROIProcessingNameArray": [ "roi_default" ], "ImageSourceName": "", "MaxParallelTasks": 4, "MinImageCaptureInterval": 0, "Name": "Default_1", "OutputOriginalImage": 0, "SemanticProcessingNameArray": null, "Timeout": 99999 } ], "ErrorMessage": "successful.", "GlobalParameter": { "MaxTotalImageDimension": 0 }, "ImageParameterOptions": [ { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 2300, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, { "Mode": "GEM_GRAY_EQUALIZE", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, { "Mode": "GEM_GRAY_SMOOTH", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, { "Mode": "GEM_SHARPEN_SMOOTH", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_1" }, { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 99999, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_Decode" } ], "TargetROIDefOptions": [ { "BaseTargetROIDefName": "", "EnableResultsDeduplication": 1, "Location": { "Offset": { "FirstPoint": [ 0, 0, 1, 1 ], "FourthPoint": [ 0, 100, 1, 1 ], "MeasuredByPercentage": 1, "ReferenceObjectOriginIndex": 0, "ReferenceObjectType": "ROT_ATOMIC_OBJECT", "ReferenceXAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 0, "LengthReference": "LR_X", "RotationAngle": 90 }, "ReferenceYAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 1, "LengthReference": "LR_Y", "RotationAngle": 90 }, "SecondPoint": [ 100, 0, 1, 1 ], "ThirdPoint": [ 100, 100, 1, 1 ] }, "ReferenceObjectFilter": null }, "Name": "roi_default", "PauseFlag": 0, "TaskSettingNameArray": [ "BR_1" ] } ] }
Curved QR Code
Issue: When a barcode is wrapped on a cylindrical object such as a pop can, the resulting barcode image is curved. The deformed barcode is very challenging to scan correctly. Solution: Dynamsoft Barcode Reader SDK provides several image processing methods to combat deformation. These helps to scan curved, crumpled, distorted and other types of challenging barcodes. { "BarcodeReaderTaskSettingOptions": [ { "BarcodeFormatIds": [ "BF_QR_CODE", "BF_MICRO_QR" ], "BarcodeFormatSpecificationNameArray": null, "BaseBarcodeReaderTaskSettingName": "", "DPMCodeReadingModes": [ { "BarcodeFormat": "BF_DATAMATRIX", "Mode": "DPMCRM_SKIP" } ], "ExpectedBarcodesCount": 0, "MaxThreadsInOneTask": 4, "Name": "BR_1", "SectionArray": [ { "ImageParameterName": "IP_1", "Section": "ST_REGION_PREDETECTION", "StageArray": [ { "RegionPredetectionModes": [ { "AspectRatioRange": "", "DetectionModelName": "", "FindAccurateBoundary": 0, "ForeAndBackgroundColours": "", "HeightRange": "", "MeasuredByPercentage": 1, "MinImageDimension": 262144, "Mode": "RPM_GENERAL", "RelativeRegions": "", "Sensitivity": 1, "SpatialIndexBlockSize": 5, "WidthRange": "" } ], "Stage": "SST_PREDETECT_REGIONS" } ] }, { "ImageParameterName": "IP_1", "Section": "ST_BARCODE_LOCALIZATION", "StageArray": [ { "LocalizationModes": [ { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_CONNECTED_BLOCKS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_SCAN_DIRECTLY", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_STATISTICS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_LINES", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 } ], "Stage": "SST_LOCALIZE_CANDIDATE_BARCODES" }, { "Stage": "SST_LOCALIZE_BARCODES" } ] }, { "ImageParameterName": "IP_Decode", "Section": "ST_BARCODE_DECODING", "StageArray": [ { "DeformationResistingModes": [ { "BinarizationMode": { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 }, "GrayscaleEnhancementMode": { "Mode": "GEM_AUTO", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, "Level": 5, "Mode": "DRM_GENERAL" }, { "BinarizationMode": { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 }, "GrayscaleEnhancementMode": { "Mode": "GEM_AUTO", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, "Level": 5, "Mode": "DRM_BROAD_WARP" }, { "BinarizationMode": { "BinarizationThreshold": -1, "BlockSizeX": 30, "BlockSizeY": 30, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 }, "GrayscaleEnhancementMode": { "Mode": "GEM_AUTO", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, "Level": 5, "Mode": "DRM_DEWRINKLE" } ], "Stage": "SST_RESIST_DEFORMATION" }, { "BarcodeComplementModes": [ { "Mode": "BCM_SKIP" } ], "Stage": "SST_COMPLEMENT_BARCODE" }, { "BarcodeScaleModes": [ { "AcuteAngleWithXThreshold": -1, "Mode": "BSM_AUTO", "ModuleSizeThreshold": 0, "TargetModuleSize": 0 } ], "Stage": "SST_SCALE_BARCODE_IMAGE" }, { "DeblurModes": null, "ReturnBarcodeZoneClarity": 0, "Stage": "SST_DECODE_BARCODES" } ] } ], "TextResultOrderModes": [ { "Mode": "TROM_CONFIDENCE" }, { "Mode": "TROM_POSITION" }, { "Mode": "TROM_FORMAT" } ] } ], "CaptureVisionTemplates": [ { "ImageROIProcessingNameArray": [ "roi_default" ], "ImageSourceName": "", "MaxParallelTasks": 4, "MinImageCaptureInterval": 0, "Name": "Default_1", "OutputOriginalImage": 0, "SemanticProcessingNameArray": null, "Timeout": 99999 } ], "ErrorMessage": "successful.", "GlobalParameter": { "MaxTotalImageDimension": 0 }, "ImageParameterOptions": [ { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 2300, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, { "Mode": "GEM_GRAY_EQUALIZE", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, { "Mode": "GEM_GRAY_SMOOTH", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, { "Mode": "GEM_SHARPEN_SMOOTH", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_1" }, { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 99999, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_Decode" } ], "TargetROIDefOptions": [ { "BaseTargetROIDefName": "", "EnableResultsDeduplication": 1, "Location": { "Offset": { "FirstPoint": [ 0, 0, 1, 1 ], "FourthPoint": [ 0, 100, 1, 1 ], "MeasuredByPercentage": 1, "ReferenceObjectOriginIndex": 0, "ReferenceObjectType": "ROT_ATOMIC_OBJECT", "ReferenceXAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 0, "LengthReference": "LR_X", "RotationAngle": 90 }, "ReferenceYAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 1, "LengthReference": "LR_Y", "RotationAngle": 90 }, "SecondPoint": [ 100, 0, 1, 1 ], "ThirdPoint": [ 100, 100, 1, 1 ] }, "ReferenceObjectFilter": null }, "Name": "roi_default", "PauseFlag": 0, "TaskSettingNameArray": [ "BR_1" ] } ] }
Damaged QR Code
Issue: Often you might find that a barcode is damaged, for example, scratched, marked up, or incomplete with missing corners, etc. Solution: We can try different localization methods to identify the location of the barcode that is severely damaged and then use our proprietary algorithm to complete the QR Code to improve the decoding rate. { "BarcodeReaderTaskSettingOptions": [ { "BarcodeFormatIds": [ "BF_QR_CODE", "BF_MICRO_QR" ], "BarcodeFormatSpecificationNameArray": null, "BaseBarcodeReaderTaskSettingName": "", "DPMCodeReadingModes": [ { "BarcodeFormat": "BF_DATAMATRIX", "Mode": "DPMCRM_SKIP" } ], "ExpectedBarcodesCount": 0, "MaxThreadsInOneTask": 4, "Name": "BR_1", "SectionArray": [ { "ImageParameterName": "IP_1", "Section": "ST_REGION_PREDETECTION", "StageArray": [ { "RegionPredetectionModes": [ { "AspectRatioRange": "", "DetectionModelName": "", "FindAccurateBoundary": 0, "ForeAndBackgroundColours": "", "HeightRange": "", "MeasuredByPercentage": 1, "MinImageDimension": 262144, "Mode": "RPM_GENERAL", "RelativeRegions": "", "Sensitivity": 1, "SpatialIndexBlockSize": 5, "WidthRange": "" } ], "Stage": "SST_PREDETECT_REGIONS" } ] }, { "ImageParameterName": "IP_1", "Section": "ST_BARCODE_LOCALIZATION", "StageArray": [ { "LocalizationModes": [ { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_CONNECTED_BLOCKS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_SCAN_DIRECTLY", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_STATISTICS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_LINES", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 } ], "Stage": "SST_LOCALIZE_CANDIDATE_BARCODES" }, { "Stage": "SST_LOCALIZE_BARCODES" } ] }, { "ImageParameterName": "IP_Decode", "Section": "ST_BARCODE_DECODING", "StageArray": [ { "DeformationResistingModes": [ { "BinarizationMode": { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 }, "GrayscaleEnhancementMode": { "Mode": "GEM_AUTO", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, "Level": 5, "Mode": "DRM_SKIP" } ], "Stage": "SST_RESIST_DEFORMATION" }, { "BarcodeComplementModes": [ { "Mode": "BCM_SKIP" } ], "Stage": "SST_COMPLEMENT_BARCODE" }, { "BarcodeScaleModes": [ { "AcuteAngleWithXThreshold": -1, "Mode": "BSM_AUTO", "ModuleSizeThreshold": 0, "TargetModuleSize": 0 } ], "Stage": "SST_SCALE_BARCODE_IMAGE" }, { "DeblurModes": null, "ReturnBarcodeZoneClarity": 0, "Stage": "SST_DECODE_BARCODES" } ] } ], "TextResultOrderModes": [ { "Mode": "TROM_CONFIDENCE" }, { "Mode": "TROM_POSITION" }, { "Mode": "TROM_FORMAT" } ] } ], "CaptureVisionTemplates": [ { "ImageROIProcessingNameArray": [ "roi_default" ], "ImageSourceName": "", "MaxParallelTasks": 4, "MinImageCaptureInterval": 0, "Name": "Default_1", "OutputOriginalImage": 0, "SemanticProcessingNameArray": null, "Timeout": 100000 } ], "ErrorMessage": "successful.", "GlobalParameter": { "MaxTotalImageDimension": 0 }, "ImageParameterOptions": [ { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 2300, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, { "Mode": "GEM_GRAY_EQUALIZE", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, { "Mode": "GEM_GRAY_SMOOTH", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_1" }, { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 99999, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_Decode" } ], "TargetROIDefOptions": [ { "BaseTargetROIDefName": "", "EnableResultsDeduplication": 1, "Location": { "Offset": { "FirstPoint": [ 0, 0, 1, 1 ], "FourthPoint": [ 0, 100, 1, 1 ], "MeasuredByPercentage": 1, "ReferenceObjectOriginIndex": 0, "ReferenceObjectType": "ROT_ATOMIC_OBJECT", "ReferenceXAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 0, "LengthReference": "LR_X", "RotationAngle": 90 }, "ReferenceYAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 1, "LengthReference": "LR_Y", "RotationAngle": 90 }, "SecondPoint": [ 100, 0, 1, 1 ], "ThirdPoint": [ 100, 100, 1, 1 ] }, "ReferenceObjectFilter": null }, "Name": "roi_default", "PauseFlag": 0, "TaskSettingNameArray": [ "BR_1" ] } ] }
DataMatrix Code with Red-Striped Background
Issue: Barcodes printed on a textured background are more difficult to decode. For example, the barcodes in the sample image are printed on a red-striped backgroud, which affects the binarization result. Solution: We can increase the weight of the red channel during the binarization process to reduce the impact of the red stripes. { "BarcodeReaderTaskSettingOptions": [ { "BarcodeFormatIds": [ "BF_DEFAULT" ], "BarcodeFormatSpecificationNameArray": null, "BaseBarcodeReaderTaskSettingName": "", "DPMCodeReadingModes": [ { "BarcodeFormat": "BF_DATAMATRIX", "Mode": "DPMCRM_SKIP" } ], "ExpectedBarcodesCount": 2, "MaxThreadsInOneTask": 4, "Name": "BR_1", "SectionArray": [ { "ImageParameterName": "IP_1", "Section": "ST_REGION_PREDETECTION", "StageArray": [ { "RegionPredetectionModes": [ { "AspectRatioRange": "", "DetectionModelName": "", "FindAccurateBoundary": 0, "ForeAndBackgroundColours": "", "HeightRange": "", "MeasuredByPercentage": 1, "MinImageDimension": 262144, "Mode": "RPM_GENERAL", "RelativeRegions": "", "Sensitivity": 1, "SpatialIndexBlockSize": 5, "WidthRange": "" } ], "Stage": "SST_PREDETECT_REGIONS" } ] }, { "ImageParameterName": "IP_1", "Section": "ST_BARCODE_LOCALIZATION", "StageArray": [ { "LocalizationModes": [ { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_CONNECTED_BLOCKS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_SCAN_DIRECTLY", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_STATISTICS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_LINES", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 } ], "Stage": "SST_LOCALIZE_CANDIDATE_BARCODES" }, { "Stage": "SST_LOCALIZE_BARCODES" } ] }, { "ImageParameterName": "IP_Decode", "Section": "ST_BARCODE_DECODING", "StageArray": [ { "DeformationResistingModes": [ { "BinarizationMode": { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 }, "GrayscaleEnhancementMode": { "Mode": "GEM_AUTO", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, "Level": 5, "Mode": "DRM_SKIP" } ], "Stage": "SST_RESIST_DEFORMATION" }, { "BarcodeComplementModes": [ { "Mode": "BCM_SKIP" } ], "Stage": "SST_COMPLEMENT_BARCODE" }, { "BarcodeScaleModes": [ { "AcuteAngleWithXThreshold": -1, "Mode": "BSM_AUTO", "ModuleSizeThreshold": 0, "TargetModuleSize": 0 } ], "Stage": "SST_SCALE_BARCODE_IMAGE" }, { "DeblurModes": null, "ReturnBarcodeZoneClarity": 0, "Stage": "SST_DECODE_BARCODES" } ] } ], "TextResultOrderModes": [ { "Mode": "TROM_CONFIDENCE" }, { "Mode": "TROM_POSITION" }, { "Mode": "TROM_FORMAT" } ] } ], "CaptureVisionTemplates": [ { "ImageROIProcessingNameArray": [ "roi_default" ], "ImageSourceName": "", "MaxParallelTasks": 4, "MinImageCaptureInterval": 0, "Name": "Default_1", "OutputOriginalImage": 0, "SemanticProcessingNameArray": null, "Timeout": 3500 } ], "ErrorMessage": "successful.", "GlobalParameter": { "MaxTotalImageDimension": 0 }, "ImageParameterOptions": [ { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 2300, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": 0, "GreenChannelWeight": 0, "Mode": "CICM_GENERAL", "RedChannelWeight": 1000, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 30, "BlockSizeY": 30, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_1" }, { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 99999, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_Decode" } ], "TargetROIDefOptions": [ { "BaseTargetROIDefName": "", "EnableResultsDeduplication": 1, "Location": { "Offset": { "FirstPoint": [ 0, 0, 1, 1 ], "FourthPoint": [ 0, 100, 1, 1 ], "MeasuredByPercentage": 1, "ReferenceObjectOriginIndex": 0, "ReferenceObjectType": "ROT_ATOMIC_OBJECT", "ReferenceXAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 0, "LengthReference": "LR_X", "RotationAngle": 90 }, "ReferenceYAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 1, "LengthReference": "LR_Y", "RotationAngle": 90 }, "SecondPoint": [ 100, 0, 1, 1 ], "ThirdPoint": [ 100, 100, 1, 1 ] }, "ReferenceObjectFilter": null }, "Name": "roi_default", "PauseFlag": 0, "TaskSettingNameArray": [ "BR_1" ] } ] }
High Version QR Code
Issue: The higher the QR code version, the more data modules there are and the more challenging it is to read such dense QR codes. Solution: Dynamsoft Barcode Reader uses a special algorithm optimized for reading a dense QR code. Set the appropriate BarcodeScaleModes, which determines the process for scaling up an image for detecting barcodes with a small module size. { "BarcodeReaderTaskSettingOptions": [ { "BarcodeFormatIds": [ "BF_QR_CODE" ], "BarcodeFormatSpecificationNameArray": null, "BaseBarcodeReaderTaskSettingName": "", "DPMCodeReadingModes": [ { "BarcodeFormat": "BF_DATAMATRIX", "Mode": "DPMCRM_SKIP" } ], "ExpectedBarcodesCount": 0, "MaxThreadsInOneTask": 4, "Name": "BR_1", "SectionArray": [ { "ImageParameterName": "IP_1", "Section": "ST_REGION_PREDETECTION", "StageArray": [ { "RegionPredetectionModes": [ { "AspectRatioRange": "", "DetectionModelName": "", "FindAccurateBoundary": 0, "ForeAndBackgroundColours": "", "HeightRange": "", "MeasuredByPercentage": 1, "MinImageDimension": 262144, "Mode": "RPM_GENERAL", "RelativeRegions": "", "Sensitivity": 1, "SpatialIndexBlockSize": 5, "WidthRange": "" } ], "Stage": "SST_PREDETECT_REGIONS" } ] }, { "ImageParameterName": "IP_1", "Section": "ST_BARCODE_LOCALIZATION", "StageArray": [ { "LocalizationModes": [ { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_CONNECTED_BLOCKS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_SCAN_DIRECTLY", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_STATISTICS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_LINES", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 } ], "Stage": "SST_LOCALIZE_CANDIDATE_BARCODES" }, { "Stage": "SST_LOCALIZE_BARCODES" } ] }, { "ImageParameterName": "IP_Decode", "Section": "ST_BARCODE_DECODING", "StageArray": [ { "DeformationResistingModes": [ { "BinarizationMode": { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 }, "GrayscaleEnhancementMode": { "Mode": "GEM_AUTO", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, "Level": 5, "Mode": "DRM_SKIP" } ], "Stage": "SST_RESIST_DEFORMATION" }, { "BarcodeComplementModes": [ { "Mode": "BCM_SKIP" } ], "Stage": "SST_COMPLEMENT_BARCODE" }, { "BarcodeScaleModes": [ { "AcuteAngleWithXThreshold": -1, "Mode": "BSM_AUTO", "ModuleSizeThreshold": 0, "TargetModuleSize": 0 } ], "Stage": "SST_SCALE_BARCODE_IMAGE" }, { "DeblurModes": null, "ReturnBarcodeZoneClarity": 0, "Stage": "SST_DECODE_BARCODES" } ] } ], "TextResultOrderModes": [ { "Mode": "TROM_CONFIDENCE" }, { "Mode": "TROM_POSITION" }, { "Mode": "TROM_FORMAT" } ] } ], "CaptureVisionTemplates": [ { "ImageROIProcessingNameArray": [ "roi_default" ], "ImageSourceName": "", "MaxParallelTasks": 4, "MinImageCaptureInterval": 0, "Name": "Default_1", "OutputOriginalImage": 0, "SemanticProcessingNameArray": null, "Timeout": 5000 } ], "ErrorMessage": "successful.", "GlobalParameter": { "MaxTotalImageDimension": 0 }, "ImageParameterOptions": [ { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 99999, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_1" }, { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 99999, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_Decode" } ], "TargetROIDefOptions": [ { "BaseTargetROIDefName": "", "EnableResultsDeduplication": 1, "Location": { "Offset": { "FirstPoint": [ 0, 0, 1, 1 ], "FourthPoint": [ 0, 100, 1, 1 ], "MeasuredByPercentage": 1, "ReferenceObjectOriginIndex": 0, "ReferenceObjectType": "ROT_ATOMIC_OBJECT", "ReferenceXAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 0, "LengthReference": "LR_X", "RotationAngle": 90 }, "ReferenceYAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 1, "LengthReference": "LR_Y", "RotationAngle": 90 }, "SecondPoint": [ 100, 0, 1, 1 ], "ThirdPoint": [ 100, 100, 1, 1 ] }, "ReferenceObjectFilter": null }, "Name": "roi_default", "PauseFlag": 0, "TaskSettingNameArray": [ "BR_1" ] } ] }
Inverted DPM Codes
Issue: Direct Part Marks (DPM) are codes, symbols, and texts that are etched or printed directly onto the surface of a part, which has a different texture from marks printed on paper. They are often inverted on a dark surface. Solution: Enable the DPM reading mode and invert the color of the image using GrayscaleTransformationModes. { "BarcodeFormatSpecificationOptions": [ { "AllModuleDeviation": 0, "AustralianPostEncodingTable": "C", "BarcodeAngleRangeArray": null, "BarcodeBytesLengthRangeArray": null, "BarcodeComplementModes": null, "BarcodeFormatIds": [ "BF_PDF417", "BF_QR_CODE", "BF_DATAMATRIX", "BF_AZTEC", "BF_MICRO_QR", "BF_MICRO_PDF417", "BF_DOTCODE" ], "BarcodeHeightRangeArray": null, "BarcodeTextLengthRangeArray": null, "BarcodeTextRegExPattern": "", "BarcodeWidthRangeArray": null, "BarcodeZoneBarCountRangeArray": null, "BarcodeZoneMinDistanceToImageBorders": 0, "BaseBarcodeFormatSpecification": "", "Code128Subset": "", "DataMatrixModuleIsotropic": 1, "DataMatrixSizeOptions": [ "DMS_DEFAULT" ], "DeformationResistingModes": null, "EnableAddOnCode": 0, "EnableDataMatrixECC000-140": 0, "EnableQRCodeModel1": 0, "FindUnevenModuleBarcode": 1, "HeadModuleRatio": "", "MSICodeCheckDigitCalculation": "MSICCDC_MOD_10", "MinQuietZoneWidth": 4, "MinRatioOfBarcodeZoneWidthToHeight": 0, "MinResultConfidence": 30, "MirrorMode": "MM_BOTH", "ModuleSizeRangeArray": null, "Name": "bfs1", "PartitionModes": [ "PM_WHOLE_BARCODE", "PM_ALIGNMENT_PARTITION" ], "PatchCodeSearchingMargins": { "Bottom": 20, "Left": 20, "MeasuredByPercentage": 1, "Right": 20, "Top": 20 }, "RequireStartStopChars": 1, "ReturnPartialBarcodeValue": 1, "StandardFormat": "", "TailModuleRatio": "", "VerifyCheckDigit": 0 }, { "AllModuleDeviation": 0, "AustralianPostEncodingTable": "C", "BarcodeAngleRangeArray": null, "BarcodeBytesLengthRangeArray": null, "BarcodeComplementModes": null, "BarcodeFormatIds": [ "BF_ALL" ], "BarcodeHeightRangeArray": null, "BarcodeTextLengthRangeArray": null, "BarcodeTextRegExPattern": "", "BarcodeWidthRangeArray": null, "BarcodeZoneBarCountRangeArray": null, "BarcodeZoneMinDistanceToImageBorders": 0, "BaseBarcodeFormatSpecification": "", "Code128Subset": "", "DataMatrixModuleIsotropic": 1, "DataMatrixSizeOptions": [ "DMS_DEFAULT" ], "DeformationResistingModes": null, "EnableAddOnCode": 0, "EnableDataMatrixECC000-140": 0, "EnableQRCodeModel1": 0, "FindUnevenModuleBarcode": 1, "HeadModuleRatio": "", "MSICodeCheckDigitCalculation": "MSICCDC_MOD_10", "MinQuietZoneWidth": 4, "MinRatioOfBarcodeZoneWidthToHeight": 0, "MinResultConfidence": 30, "MirrorMode": "MM_NORMAL", "ModuleSizeRangeArray": null, "Name": "bfs2", "PartitionModes": [ "PM_WHOLE_BARCODE", "PM_ALIGNMENT_PARTITION" ], "PatchCodeSearchingMargins": { "Bottom": 20, "Left": 20, "MeasuredByPercentage": 1, "Right": 20, "Top": 20 }, "RequireStartStopChars": 1, "ReturnPartialBarcodeValue": 1, "StandardFormat": "", "TailModuleRatio": "", "VerifyCheckDigit": 0 } ], "BarcodeReaderTaskSettingOptions": [ { "BarcodeFormatIds": [ "BF_QR_CODE", "BF_DATAMATRIX", "BF_MICRO_QR" ], "BarcodeFormatSpecificationNameArray": [ "bfs1", "bfs2" ], "BaseBarcodeReaderTaskSettingName": "", "DPMCodeReadingModes": [ { "BarcodeFormat": "BF_DATAMATRIX", "Mode": "DPMCRM_GENERAL" } ], "ExpectedBarcodesCount": 999, "MaxThreadsInOneTask": 4, "Name": "task-read-barcodes", "SectionArray": [ { "ImageParameterName": "ip-read-barcodes", "Section": "ST_REGION_PREDETECTION", "StageArray": [ { "RegionPredetectionModes": [ { "AspectRatioRange": "", "DetectionModelName": "", "FindAccurateBoundary": 0, "ForeAndBackgroundColours": "", "HeightRange": "", "MeasuredByPercentage": 1, "MinImageDimension": 262144, "Mode": "RPM_GENERAL", "RelativeRegions": "", "Sensitivity": 1, "SpatialIndexBlockSize": 5, "WidthRange": "" } ], "Stage": "SST_PREDETECT_REGIONS" } ] }, { "ImageParameterName": "ip-read-barcodes", "Section": "ST_BARCODE_LOCALIZATION", "StageArray": [ { "LocalizationModes": [ { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_CONNECTED_BLOCKS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_SCAN_DIRECTLY", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_STATISTICS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_LINES", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 } ], "Stage": "SST_LOCALIZE_CANDIDATE_BARCODES" }, { "Stage": "SST_LOCALIZE_BARCODES" } ] }, { "ImageParameterName": "ip-read-barcodes", "Section": "ST_BARCODE_DECODING", "StageArray": [ { "DeformationResistingModes": [ { "BinarizationMode": { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 }, "GrayscaleEnhancementMode": { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, "Level": 5, "Mode": "DRM_SKIP" } ], "Stage": "SST_RESIST_DEFORMATION" }, { "BarcodeComplementModes": [ { "Mode": "BCM_SKIP" } ], "Stage": "SST_COMPLEMENT_BARCODE" }, { "BarcodeScaleModes": [ { "AcuteAngleWithXThreshold": -1, "Mode": "BSM_AUTO", "ModuleSizeThreshold": 0, "TargetModuleSize": 0 } ], "Stage": "SST_SCALE_BARCODE_IMAGE" }, { "DeblurModes": null, "ReturnBarcodeZoneClarity": 0, "Stage": "SST_DECODE_BARCODES" } ] } ], "TextResultOrderModes": [ { "Mode": "TROM_CONFIDENCE" }, { "Mode": "TROM_POSITION" }, { "Mode": "TROM_FORMAT" } ] } ], "CaptureVisionTemplates": [ { "ImageROIProcessingNameArray": [ "roi-read-barcodes" ], "ImageSourceName": "", "MaxParallelTasks": 4, "MinImageCaptureInterval": 0, "Name": "Default_1", "OutputOriginalImage": 0, "SemanticProcessingNameArray": null, "Timeout": 10000 } ], "GlobalParameter": { "MaxTotalImageDimension": 0 }, "ImageParameterOptions": [ { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 2300, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" }, { "Mode": "GTM_INVERTED" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 1, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "ip-read-barcodes" } ], "TargetROIDefOptions": [ { "BaseTargetROIDefName": "", "EnableResultsDeduplication": 1, "Location": { "Offset": { "FirstPoint": [ 0, 0, 1, 1 ], "FourthPoint": [ 0, 100, 1, 1 ], "MeasuredByPercentage": 1, "ReferenceObjectOriginIndex": 0, "ReferenceObjectType": "ROT_ATOMIC_OBJECT", "ReferenceXAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 0, "LengthReference": "LR_X", "RotationAngle": 90 }, "ReferenceYAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 1, "LengthReference": "LR_Y", "RotationAngle": 90 }, "SecondPoint": [ 100, 0, 1, 1 ], "ThirdPoint": [ 100, 100, 1, 1 ] }, "ReferenceObjectFilter": null }, "Name": "roi-read-barcodes", "PauseFlag": 0, "TaskSettingNameArray": [ "task-read-barcodes" ] } ] }
Scan QR Code from Screen
Issue: When you scan a barcode from a screen on a monitor, a TV or a mobile phone, the image contains roughly parallel dark and light bands superimposed, called the moiré pattern. The interfering pattern makes decoding the barcode very challenging. Solution: Dynamsoft Barcode Reader SDK provides an image processing step to remove the moiré texture and would quickly decode the barcode. It can be configured through TextureDetectionModes. { "BarcodeReaderTaskSettingOptions": [ { "BarcodeFormatIds": [ "BF_DEFAULT" ], "BarcodeFormatSpecificationNameArray": null, "BaseBarcodeReaderTaskSettingName": "", "DPMCodeReadingModes": [ { "BarcodeFormat": "BF_DATAMATRIX", "Mode": "DPMCRM_SKIP" } ], "ExpectedBarcodesCount": 0, "MaxThreadsInOneTask": 4, "Name": "BR_1", "SectionArray": [ { "ImageParameterName": "IP_1", "Section": "ST_REGION_PREDETECTION", "StageArray": [ { "RegionPredetectionModes": [ { "AspectRatioRange": "", "DetectionModelName": "", "FindAccurateBoundary": 0, "ForeAndBackgroundColours": "", "HeightRange": "", "MeasuredByPercentage": 1, "MinImageDimension": 262144, "Mode": "RPM_GENERAL", "RelativeRegions": "", "Sensitivity": 1, "SpatialIndexBlockSize": 5, "WidthRange": "" } ], "Stage": "SST_PREDETECT_REGIONS" } ] }, { "ImageParameterName": "IP_1", "Section": "ST_BARCODE_LOCALIZATION", "StageArray": [ { "LocalizationModes": [ { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_CONNECTED_BLOCKS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_SCAN_DIRECTLY", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_STATISTICS", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_LINES", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 } ], "Stage": "SST_LOCALIZE_CANDIDATE_BARCODES" }, { "Stage": "SST_LOCALIZE_BARCODES" } ] }, { "ImageParameterName": "IP_Decode", "Section": "ST_BARCODE_DECODING", "StageArray": [ { "DeformationResistingModes": [ { "BinarizationMode": { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 }, "GrayscaleEnhancementMode": { "Mode": "GEM_AUTO", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, "Level": 5, "Mode": "DRM_SKIP" } ], "Stage": "SST_RESIST_DEFORMATION" }, { "BarcodeComplementModes": [ { "Mode": "BCM_SKIP" } ], "Stage": "SST_COMPLEMENT_BARCODE" }, { "BarcodeScaleModes": [ { "AcuteAngleWithXThreshold": -1, "Mode": "BSM_AUTO", "ModuleSizeThreshold": 0, "TargetModuleSize": 0 } ], "Stage": "SST_SCALE_BARCODE_IMAGE" }, { "DeblurModes": null, "ReturnBarcodeZoneClarity": 0, "Stage": "SST_DECODE_BARCODES" } ] } ], "TextResultOrderModes": [ { "Mode": "TROM_CONFIDENCE" }, { "Mode": "TROM_POSITION" }, { "Mode": "TROM_FORMAT" } ] } ], "CaptureVisionTemplates": [ { "ImageROIProcessingNameArray": [ "roi_default" ], "ImageSourceName": "", "MaxParallelTasks": 4, "MinImageCaptureInterval": 0, "Name": "Default_1", "OutputOriginalImage": 0, "SemanticProcessingNameArray": null, "Timeout": 10000 } ], "ErrorMessage": "successful.", "GlobalParameter": { "MaxTotalImageDimension": 0 }, "ImageParameterOptions": [ { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 2300, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_1" }, { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 99999, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_Decode" } ], "TargetROIDefOptions": [ { "BaseTargetROIDefName": "", "EnableResultsDeduplication": 1, "Location": { "Offset": { "FirstPoint": [ 0, 0, 1, 1 ], "FourthPoint": [ 0, 100, 1, 1 ], "MeasuredByPercentage": 1, "ReferenceObjectOriginIndex": 0, "ReferenceObjectType": "ROT_ATOMIC_OBJECT", "ReferenceXAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 0, "LengthReference": "LR_X", "RotationAngle": 90 }, "ReferenceYAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 1, "LengthReference": "LR_Y", "RotationAngle": 90 }, "SecondPoint": [ 100, 0, 1, 1 ], "ThirdPoint": [ 100, 100, 1, 1 ] }, "ReferenceObjectFilter": null }, "Name": "roi_default", "PauseFlag": 0, "TaskSettingNameArray": [ "BR_1" ] } ] }
Code39 with Zero Margin
Issue: Vehicle Identification Number (VIN) is sometimes accompanied with a code 39 barcode underneath. The placement is usually very tight and close to the series of digits resulting in a barcode with zero upper and lower margin. Many barcode scanners fail to read such barcodes. Solution: Dynamsoft offers many barcode localization methods catering to different usage scenarios. The Lines localization method localizes barcodes by searching for groups of lines. This is optimized for 1D and PDF417 barcodes which is suitable for identifying barcodes with little margin. { "BarcodeReaderTaskSettingOptions": [ { "BarcodeFormatIds": [ "BF_DEFAULT" ], "BarcodeFormatSpecificationNameArray": null, "BaseBarcodeReaderTaskSettingName": "", "DPMCodeReadingModes": [ { "BarcodeFormat": "BF_DATAMATRIX", "Mode": "DPMCRM_SKIP" } ], "ExpectedBarcodesCount": 0, "MaxThreadsInOneTask": 4, "Name": "BR_1", "SectionArray": [ { "ImageParameterName": "IP_1", "Section": "ST_REGION_PREDETECTION", "StageArray": [ { "RegionPredetectionModes": [ { "AspectRatioRange": "", "DetectionModelName": "", "FindAccurateBoundary": 0, "ForeAndBackgroundColours": "", "HeightRange": "", "MeasuredByPercentage": 1, "MinImageDimension": 262144, "Mode": "RPM_GENERAL", "RelativeRegions": "", "Sensitivity": 1, "SpatialIndexBlockSize": 5, "WidthRange": "" } ], "Stage": "SST_PREDETECT_REGIONS" } ] }, { "ImageParameterName": "IP_1", "Section": "ST_BARCODE_LOCALIZATION", "StageArray": [ { "LocalizationModes": [ { "ConfidenceThreshold": 60, "IsOneDStacked": 0, "Mode": "LM_LINES", "ModuleSize": 0, "ScanDirection": 0, "ScanStride": 0 }, { "Mode": "LM_SCAN_DIRECTLY", "ScanStride": 0, "ScanDirection": 0, "IsOneDStacked": 0 } ], "Stage": "SST_LOCALIZE_CANDIDATE_BARCODES" }, { "Stage": "SST_LOCALIZE_BARCODES" } ] }, { "ImageParameterName": "IP_Decode", "Section": "ST_BARCODE_DECODING", "StageArray": [ { "DeformationResistingModes": [ { "BinarizationMode": { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 }, "GrayscaleEnhancementMode": { "Mode": "GEM_AUTO", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 }, "Level": 5, "Mode": "DRM_SKIP" } ], "Stage": "SST_RESIST_DEFORMATION" }, { "BarcodeComplementModes": [ { "Mode": "BCM_SKIP" } ], "Stage": "SST_COMPLEMENT_BARCODE" }, { "BarcodeScaleModes": [ { "AcuteAngleWithXThreshold": -1, "Mode": "BSM_AUTO", "ModuleSizeThreshold": 0, "TargetModuleSize": 0 } ], "Stage": "SST_SCALE_BARCODE_IMAGE" }, { "DeblurModes": null, "ReturnBarcodeZoneClarity": 0, "Stage": "SST_DECODE_BARCODES" } ] } ], "TextResultOrderModes": [ { "Mode": "TROM_CONFIDENCE" }, { "Mode": "TROM_POSITION" }, { "Mode": "TROM_FORMAT" } ] } ], "CaptureVisionTemplates": [ { "ImageROIProcessingNameArray": [ "roi_default" ], "ImageSourceName": "", "MaxParallelTasks": 4, "MinImageCaptureInterval": 0, "Name": "Default_1", "OutputOriginalImage": 0, "SemanticProcessingNameArray": null, "Timeout": 99999 } ], "ErrorMessage": "successful.", "GlobalParameter": { "MaxTotalImageDimension": 0 }, "ImageParameterOptions": [ { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 2300, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_1" }, { "ApplicableStages": [ { "Stage": "SST_INPUT_COLOR_IMAGE" }, { "ImageScaleSetting": { "EdgeLengthThreshold": 99999, "ReferenceEdge": "RE_SHORTER_EDGE", "ScaleType": "ST_SCALE_DOWN" }, "Stage": "SST_SCALE_IMAGE" }, { "ColourConversionModes": [ { "BlueChannelWeight": -1, "GreenChannelWeight": -1, "Mode": "CICM_GENERAL", "RedChannelWeight": -1, "ReferChannel": "H_CHANNEL" } ], "Stage": "SST_CONVERT_TO_GRAYSCALE" }, { "GrayscaleTransformationModes": [ { "Mode": "GTM_ORIGINAL" } ], "Stage": "SST_TRANSFORM_GRAYSCALE" }, { "GrayscaleEnhancementModes": [ { "Mode": "GEM_GENERAL", "Sensitivity": 5, "SharpenBlockSizeX": 3, "SharpenBlockSizeY": 3, "SmoothBlockSizeX": 3, "SmoothBlockSizeY": 3 } ], "Stage": "SST_ENHANCE_GRAYSCALE" }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_LOCAL_BLOCK", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_IMAGE" }, { "Stage": "SST_DETECT_TEXTURE", "TextureDetectionModes": [ { "Mode": "TDM_GENERAL_WIDTH_CONCENTRATION", "Sensitivity": 5 } ] }, { "Stage": "SST_REMOVE_TEXTURE_FROM_GRAYSCALE", "TextureRemovalStrength": 2 }, { "BinarizationModes": [ { "BinarizationThreshold": -1, "BlockSizeX": 0, "BlockSizeY": 0, "EnableFillBinaryVacancy": 1, "GrayscaleEnhancementModesIndex": -1, "Mode": "BM_AUTO", "MorphOperation": "None", "MorphOperationKernelSizeX": 0, "MorphOperationKernelSizeY": 0, "MorphShape": "Rectangle", "ThresholdCompensation": 10 } ], "Stage": "SST_BINARIZE_TEXTURE_REMOVED_GRAYSCALE" }, { "Stage": "SST_FIND_CONTOURS" }, { "ShortlineDetectionMode": { "Mode": "SDM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_DETECT_SHORTLINES" }, { "LineAssemblyMode": { "Mode": "LAM_GENERAL", "Sensitivity": 3 }, "Stage": "SST_ASSEMBLE_LINES" }, { "Stage": "SST_DETECT_TEXT_ZONES", "TextDetectionMode": { "CharHeightRange": [ 1, 1000, 1 ], "Direction": "UNKNOWN", "MaxSpacingInALine": -1, "Mode": "TTDM_LINE", "Sensitivity": 3, "StringLengthRange": null } }, { "IfEraseTextZone": 0, "Stage": "SST_REMOVE_TEXT_ZONES_FROM_BINARY" } ], "BaseImageParameterName": "", "Name": "IP_Decode" } ], "TargetROIDefOptions": [ { "BaseTargetROIDefName": "", "EnableResultsDeduplication": 1, "Location": { "Offset": { "FirstPoint": [ 0, 0, 1, 1 ], "FourthPoint": [ 0, 100, 1, 1 ], "MeasuredByPercentage": 1, "ReferenceObjectOriginIndex": 0, "ReferenceObjectType": "ROT_ATOMIC_OBJECT", "ReferenceXAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 0, "LengthReference": "LR_X", "RotationAngle": 90 }, "ReferenceYAxis": { "AxisType": "AT_MIDPOINT_EDGE", "EdgeIndex": 1, "LengthReference": "LR_Y", "RotationAngle": 90 }, "SecondPoint": [ 100, 0, 1, 1 ], "ThirdPoint": [ 100, 100, 1, 1 ] }, "ReferenceObjectFilter": null }, "Name": "roi_default", "PauseFlag": 0, "TaskSettingNameArray": [ "BR_1" ] } ] } Image Source: https://universe.roboflow.com/kirill-sergeev/vin-detection/