Technical Information
Optimize Barcode Reading
overview 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 history of inlite barcode reader docid\ premvge 5usjhfcymralw 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 optimizing image generation 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 select the barcode type 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 optimize module size 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 cibarcode modulesize property (com api) or the barcode modulesize barcode modulesize property ( net api) the module size is calculated as follows mod = printermodsizein scannerdpi; where printermodsizein 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 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 ciimage horzdpi and ciimage vertdpi ciimage vertdpi properties (com api) or the imageinfo horizontaldpi imageinfo horizontaldpi and the imageinfo verticaldpi 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 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 reduce jpeg 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 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 driver's license barcodes optimization 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 configuration of barcode reader use targeted barcode reader (tbr) if barcodes fail to read, try using targeted barcode reader described tbr targeted barcode reader docid\ krbh lutyawzphraj5lqs read only expected types of 1d barcodes 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 // reader auto1d = true; reader code39 = true; reader code128 = true; read barcodes in a known orientation tbd limit the number of expected barcodes tbd limit reading to a known barcode location smaller area reading results in faster barcode reading clearimage api allows setting an image area of interest to be processed by creating a zone zone these examples read barcodes in the upper left quadrant of the image using inlite clearimagenet; void readbarcode1d page(string filename, int page) { try { using(barcodereader reader = new barcodereader()) { // obtain image information and set zone imageio io = new imageio(); imageinfo info = io info(filename, page); reader zone = new rectangle(0, 0, info width / 2, info height / 2); // read barcodes in zone reader code39 = true; reader code128 = true; barcode\[] barcodes = reader read(filename, page); foreach(barcode barcode in barcodes) console writeline($"barcode type {barcode type} text {barcode text}"); } } catch(exception ex) { console writeline("exception " + ex tostring()); } }