How to Read Damaged Barcodes

read damaged barcode

Improving accuracy and decoding rate remains a top priority for developers working with barcode reading SDKs. While configuration tweaks and improvements in the algorithm can result in drastic improvements, end users can also play a significant role by improving the image resolution at the time the image is taken, ensuring adequate quiet zone, and avoiding other defects. For more information, read this post on how to improve barcode recognition accuracy when using an application. In this post, we look at what application developers can do to read damaged barcodes, improve barcode recognition accuracy and decoding rate by employing the following parameters in the Dynamsoft Barcode Reader SDK.

Decoding the Most Common Unreadable Barcodes

common unreadable barcodes

Regardless of industry, you are likely to encounter at least one of these most common unreadable barcode scenarios:

  • Angled
  • Curved
  • Damaged / distorted
  • Glare
  • Low contrast
  • Low light
  • Multiple
  • Shadow

In certain difficult-to-read barcodes scenarios, adjusting a few parameters may help drastically increase your decoding rate. Below is a list of parameters you can set to help with localization and image pre-processing, which prepares the image for successful decoding. Keep in mind, maximizing the accuracy comes at a cost for speed.

AntiDamageLevel

This parameter dictates how many localization algorithms to use for localizing the barcode region to maximize the chance that a severely damaged barcode can be localized. If you have an image that is severely damaged with smudges, ink splotches, markings across the barcode, etc., set the value of AntiDamageLevel to 9 to maximize the decoding rate.

crossed 1d barcode

ExpectedBarcodesCount

This parameter defaults to 0 and it tries to find at least one barcode before terminating the decoding process. In order to force the algorithm to look for as many barcodes as possible and as hard as possible, set this parameter to the exact number of barcodes in the image if you know the expected barcode count, or to a very large number such as the maximum 0X7FFFFFFF. Also, be sure to set AntiDamageLevel to 9.

multiple barcodes in retail

DeblurLevel

If you have a blurry image, you can set this property to a large value. The higher the value, the more time our library will spend on decoding images. Set it to 9 if you are willing to trade off for speed.

barcode on white bottle

GrayEqualizationSensitivity

This sets the sensitivity threshold used for gray equalization. The higher the value, the more likely gray equalization will be activated. If you have an image with a low level of contrast where the barcode is not distinctively defined from the background, set this property to 9. However, it may degrade the performance on images with a high level of contrast. So only use this parameter on poorly contrasted images.

low contrast 1d barcode

MaxDimOfFullImageAsBarcodeZone

If you have an image and the barcode region makes up almost the entire image, then you can set this property to a larger value to decode the whole image as a barcode. Set this value to something bigger than the image size to trigger the “FullImageAsBarcodeZone” mode. Therefore, the barcode result will be more accurate.

large qr code

PDFRasterDPI  

If you are trying to decode a PDF file using the DecodeFile method, the library will convert the PDF file to an image(s) first, then perform barcode recognition. To ensure your barcodes in the PDF files are readable, set the resolution to at least 300 dpi. The higher the resolution, the better.

RegionPredetectionMode

If your barcode is large and the barcode region on the image is small, we recommended setting this property to “RPM_Enable” to speed up the localization process and improve recognition accuracy.

small barcode on large suitcase

BinarizationBlockSize

Block size refers to the size of a pixel neighborhood used to calculate a threshold value for the pixel. Set the binarization block size seven times the module size can help generate a high-quality binary image. This increases the chance a barcode is localized successfully.  

ScaleDownThreshold

This parameter is mainly used to optimize for speed. However, this can be particularly helpful when the barcode region is significantly smaller relative to the whole image size.

Need More Help?

Do you have a barcode that you aren’t able to decode? Send it to support@dynamsoft.com and we will recommend possible parameters you can use to solve the decoding issues.

Learn more about Dynamsoft Barcode Reader SDK and start a free 30-day trial. For questions about Dynamsoft’s SDKs, please contact our support team.

Subscribe Newsletter

Subscribe to our mailing list to get the monthly update.

Subscribename@email.com