Poor quality and damaged barcodes

In these examples 1D barcodes (Code39 and Code128) are read. To see how to read 2D and postal barcode click here.

ClearImage readers utilize multiple internal image enhancement and optimization techniques to read substandard barcodes from poor quality images. Many image impairments can be overcome by these optimizations. However, there will always be barcodes whose peculiar impairments and quality issues are so severe or bizarre that they cannot be read with the standard engines. We refer to them as "corner case" barcodes.

The preferred method to address such corner cases is use of Inlite’s Targeted Barcode Reading technology.. This page describes an alternative approach to repair barcodes before recognition through use of image processing engines. Improving barcode and scanned image quality is also discussed.

The examples below show how to use the ImageEditor object (.NET API) or the CiRepair and CiTools objects (COM API) to improve such corner case images before invoking the barcode reader engine. The specific choice of the AdvancedBinarize method in these examples is purely for code demonstration and most probably will NOT help to read your barcodes. To obtain expert help with images that are not read by your application or the demo application (from the ClearImage SDK) contact Inlite to solve your barcode recognition challenge.

Read poor quality barcodes from an image page

C#


VB


C++


Java


PHP


Delphi


VBScript/ASP


Read poor quality barcodes from a file

These examples work with single or multi-page documents read from a file.

C#


VB


C++


Java


PHP


Delphi


VBScript/ASP


Read poor quality barcodes from a stream

These examples work with single or multi-page documents read from a stream.

C#


VB


How To Improve Barcode Quality

Achieving a high recognition rate of your barcodes is essential for production-quality imaging applications. To reach that high level of recognition it is most important to begin the document cycle with well designed, reliable barcodes. A good design takes into account the available space, the printing or rendering details and the scanning requirements. This presentation discusses the issues to related to design and implementation of reliable barcode-based imaging system.

Optimize your overall process

An important element that affects the recognition rate is the barcode module size. A module is the smallest barcode element (either bar or space) and its dimension is measured in pixels. As the barcode is read, the module size is measured and the value is made available in the CiBarcode.ModuleSize property (COM API) or the Barcode.ModuleSize property (.NET API)

The module size is a calculated as follows:

mod = PrinterModSizeIn * ScannerDPI;   Where:
  • PrinterModSizeIn is smallest physical dimension of the module on a printed document measured in inches. This value is typically configured through settings of barcode generator either in milli-inches or in pixels. In the later case value is calculated by dividing pixel size by Printer PDI
  • ScannerDPI is the scanning resolution. This value is typically written by scanner into an image property (also called tags) in the image file header. It is is available as the CiImage.HorzDpi and CiImage.VertDpi properties (COM API) or the ImageInfo.HorizontalDpi and the ImageInfo.VerticalDpi properties (.NET API)
    • Image scanners usually configure the image resolution from a Preferences user dialog. Most commercial scanning resolutions are set between 150 to 300 dpi.
    • FAX machines use standard preset values of 204dpi in the horizontal direction and 196 dpi (fine mode) or 98 dpi (standard mode) in the vertical direction. Consequently, horizontally oriented barcodes survive better on faxed pages.

Images from cameras or cell phones do not have a fixed resolution since they do not use "contact" scanning. These devices often set the resolution tag in the JPG files to 72dpi or 1dpi, but these value do not reflect the actual image resolution. The measured module size can only be obtained from ModuleSize property.

Recommendations:

  • Configure your production process (i.e. printing then scanning) to deliver module sizes in the range of:
    • 1D and PDF417 barcodes from 3 pixels to 10 pixels
    • QR and DataMatrix barcodes from 5 pixels to 15 pixels
  • If you use an image scanner and can control the scanning properties:
    • Set scanner resolution setting to achieve above desired module size.
    • It is preferable to use grayscale scanning, and to NOT use JPEG compression (see below)
    • If the image has to be stored as bitonal or with a specific DPI, then use the ClearImage scaling and binarization methods.
      Then use ClearImage to save your image in desired format.
  • If can control document creation configure barcode generator to achieve above module size, taking in account scanning or faxing resolution.
    • Use Inlite’s Barcodes For Documents to optimize barcode generation.

Reduce JPEG compression damages

JPEG Compression is the primary method for saving grayscale and color images. JPEG compressed images can be stored as a single page, JPG file, or as images in multi page TIFF or PDF files. While JPEG compression preserves the general appearance and text readability of the image, it can damage the quality of barcodes. This application note explains these issues in more detail.

Recommendations:

  • If the raw color or grayscale image bitmaps from the scanning driver are available in
    memory, use them in that form rather than opening the compressed files.
  • If the color or grayscale images must be saved and read from file, then save them uncompressed (BMP, Uncompressed TIFF) or with loss less compression (LZW). Most SaveAs dialogs offer a selection of file Formats and compression options.
  • If JPEG compression is required use the highest quality JPEG setting to save the files. Digital cameras usually offer a menu to set the "Image Quality" to high, expressed in Percent (closer to 100% is better) or as a file size (larger is better). Also, you can use other methods to mitigate the negative effects of JPEG:
    • Make the barcode larger.
    • Increase scanning resolution.
    • Use 2D barcodes to take advantage of their Error Correction capabilities
    • For PDF417 – Specify a higher level of ECC to assure sufficient amount of correction data.
  • Contact support@inlitersearch.com if you have difficulties with your images.

Contacting Inlite Technical Support

Contact Inlite at support@inliteresearch.com to help you:

  • Maximize the number of barcodes recognized
  • Optimize the process to achieve maximum throughput.

Please include this information with your support request:

  • Representative set of your typical image files (up to 10 files).
    Large files (> 1MB) are typically transferred through online file-sharing service (dropbox.com or service of your choice)
  • Describe you barcode-based process:
    • How barcodes are generated?
    • How images with barcode are acquired?
  • What is your programming language?
  • If you already have code developed, send us snippets showing all calls to ClearImage
    If possible send us zipped project that can be build and modified in our environment,