Optimize Barcode Reading
Inlite barcode readers are optimized for high recognition rates and speed with minimum configuration for the absolute majority of images. However, your specific project might benefit from additional steps to reduce the failure rate and/or maximize processing speed. Broadly steps are grouped as:
- Optimization of image generation.
- Selection of a barcode reader optimized for your images. This document provides background on why Inlite Barcode Reader is the best for the majority of projects.
- Configuration of barcode reader.
Barcode reading failures can be:
- No-Read. Barcode is present but is not read. This is the most probable type of failure.
- Misread. Barcode is present, and it is read, but the value is incorrect; that is, output data differs from what was on the input of the barcode generator. This type of failure is very rare.
- False positive. Barcode is not present, but it is read. This type of failure is very rare.
To reach that high level of recognition, it is most important to begin the document cycle with well-designed, reliable barcodes. A good design considers the available space, the printing or rendering details, and the scanning requirements. This presentation discusses the issues related to the design and implementation of reliable barcode-based imaging systems.
Barcode selection can affect both failure rate and reading speed. Barcode standards have been improving to optimize for both reading speed (like QR code) and recognition rate (like 2D barcodes and Code 128). Therefore, the use of the most modern barcodes is preferable. These barcodes also have lower page area requirements.
If you have control over type selection, we recommend the following:
- Use 2D barcodes (QR, PDF417, Datamatrix). Error correction of 2D barcodes eliminates misreads. QR barcode typically reads faster.
- Use Code128, which uses a mandatory checksum character that protects against misreads and false positives. Commonly used, 1D barcode Code39 is usually generated without a checksum character which makes it more susceptible to misreads and false positives.
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 available in the CiBarcode.ModuleSize property (COM API) or the Barcode.ModuleSize property (.NET API)
The module size is calculated as follows:
Where:
- PrinterModSizeIn is the smallest physical dimension of the module on a printed document measured in inches. This value is typically configured through settings of the barcode generator, either in milli-inches or pixels. In the latter case, the value is calculated by dividing pixel size by Printer PDI
- ScannerDPI is the scanning resolution. The scanner typically writes this value into an image property (called tags) in the image file header. It 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 204 dpi 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 values 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 to 10 pixels
- QR and DataMatrix barcodes from 5 to 15 pixels
- If you use an image scanner and can control the scanning properties:
- Set scanner resolution setting to achieve the above-desired module size.
- It is preferable to use grayscale scanning and NOT to 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 the desired format.
- If you can control document creation, configure a barcode generator to achieve the above module size, considering scanning or faxing resolution.
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 a file, save them uncompressed (BMP, Uncompressed TIFF) or with lossless 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 ensure sufficient correction data.
The image quality of the barcode on the back of the driver's license image is lower quality than for scanned documents. Licenses are covered by a relatively thick laminated coating that diffuses the images and may be scratched or smudged.
The ClearImage DL Reader employs multiple image processing techniques to deal with the most difficult images attuned to read the specific barcode found on the back of the licenses.
These are the best practices to achieve the highest recognition rate:
- If using a scanner, scan your driver's license as a grayscale at a resolution of 300 dpi.
- If using a camera, then
- Use 3 to 5 Mega Pixel setting
- Take the picture head-on to keep the barcode rectangular
- Center the driver's license in the middle of the frame, maximizing the size of the driver's license within the picture.
- Avoid flash or shadows. Even illumination is best.
- Avoid using low-quality JPEG compression when saving images. Set the highest JPEG quality possible.
If barcodes fail to read, try using Targeted Barcode Reader described here.
Most types of 1D barcodes can be automatically identified, enabling auto-detection. Limiting reading only the expected barcode types (e.g., Code 39 or Code 128) or their combination can improve speed.
TBD
TBD
Smaller area reading results in faster barcode reading. ClearImage API allows setting an image area of interest to be processed by creating a zone.
These examples read barcodes in the upper left quadrant of the image.