Chapter 4. Developer Tip: Improve Barcode Recognition Rates

Chapter 4. Developer Tip: Improve Barcode Recognition Rates

Developer Tip: Improve Barcode Recognition Rates


The quality of the barcode image produced by your chosen barcode generator matters. Generally, a barcode reader processes the counting of pixels in an area to determine the width and location of a particular bar in a barcode symbol. So, a lack of resolution can interfere with this process. Usually, a minimum of 200 dpi is needed for acceptable barcode recognition. The higher you can go in resolution the better. Most organizations will seek to balance good barcode recognition with storage savings realized by minimizing resolution. Just be sure not to sacrifice barcode recognition efficiencies for storage efficiencies. Remember that the lower the resolution the more likely the symbol will lack the pixel density needed for good recognition. Generally, for 1D barcodes, it’s understood at least three pixels are needed per smallest bar and gap in a symbol. For 2D barcodes, it’s usually around five pixels. Sometimes, despite proper resolution settings, good pixel density just isn’t there. This could be for many reasons – poor quality labels or printer, and so on.

16-module width

Dealing with Unreadable or Damaged Barcodes

Barcode readers are only as good as the software behind them at scanning low-quality barcodes or damaged barcodes.

17-damaged barcodes

There are three main problems to look for to determine if image enhancement of a barcode is needed via pre-processing:

Dilation — adds pixels to the boundaries of objects in an image, while erosion removes pixels on an object’s boundaries. 8-dilation

Binarization — converts images to black and white leaving only two levels, allowing for an easier distinction between the edges of images. 10-binarization

Despeckle — considers the average of pixels in an area to try and detect whether a pixel is a color it should be or if it is noise created during image acquisition.


Deskew A Barcode

To deskew a barcode means to essentially straighten it out. When a barcode is skewed, depending on the angle and how skewed it is, the individual lines of a barcode can appear thicker or thinner than normal. So, when de-skewing occurs, it can actually worsen things. Also, deskewing almost always reduces the image quality, which can result in reduced barcode recognition accuracy. As with all other obstacles mentioned, you can use pre-processing features of an SDK to auto-deskew barcodes while maximizing their recognition accuracy. Regardless, having to deskew adds time and reduces speed.


Scan Distance

For 1D barcodes, scan distance is important as it can impact barcode recognition in that you may scan unwanted pixels. For example, the number “1” on a page, whether part of a text in a sentence or part of a barcode symbol, may be confused for a bar depending on its location and the scan distance. Thus, it is ideal to set a scan distance of five pixels or more for optimal decoding speed and accuracy. Generally, the higher the scan distance you can set (more than five), the faster it will become. The barcode reader’s viewing angle can also have an impact on the required distance and the reader type you will need. Generally, laser scanners are better at reading at distances more than two feet, such as compared to smartphones. They are also generally better in low-light situations. With effective pre-processing built-into good software, damaged or hard-to-read barcodes can quickly be corrected during scanning to improve recognition rates.

free online document scan

This post is a part of the series: Best Practices for Maximizing Barcode Reader Technology.

Chapter 01 Where are barcodes used

Chapter 02 Character set encoded in barcodes

Chapter 03 Barcode scanning algorithm: localization and decode

Chapter 04 Developer tip: improve barcode recognition rates

Chapter 05 Developer tip: improve barcode recognition speed

Chapter 06 Technical considerations when choosing a barcode SDK