How-To: Barcode reading from phone camera images

Phone cameras have become the most popular way to read barcodes. Tablets, digital cameras, Web Cams are also used as well. Inlite offers two options to recognize barcodes acquired by mobile camera. In both cases, images are processed on a Windows server:

  • WebAPI Barcode Reader Server that requires no development on Server side.
  • ClearImage Barcode Reader SDK to develop custom Web Server.

Both options offer algorithms optimized specifically for processing phone camera images, including Inlite’s Targeted Barcode Reading technology. The server-based reader can delivers higher recognition rate for the most challenging barcodes, and are ideal for:.

  1. Image files that are already stored on the Web
  2. Real-time barcode recognition directly from mobile device.

Improving barcode recognition rate

The quality of the barcode image is a critical to maximizing the recognition rate. Barcode quality is affected by how it was printed, and how the image was acquired. This discussion will focus on the acquisition, because it is usually the source of quality issues.
The real images below show a few, common quality impairments that can prevent the barcode from being recognized.

To optimize barcode reading from mobile device images:

Set the Picture quality in the camera settings

Set Picture Quality to High or 90% (if available)
NOTE: This controls JPEG compression. Higher quality corresponds to larger file size.  Use Picture size setting to optimize file size.

 Picture size in camera settings

Modern devices feature cameras with 12-16 Megapixels.  Such images are too large, and require more time to send to the server and to process at the server.  We suggest that

  • For image with a single barcode use 3-6 Megapixels.
  • For image with multiple barcodes use 6-9 Megapixels

Zoom and Camera positioning

  • Set zoom between 2x and 3x
  • Place camera so that barcode(s) occupies the biggest portion of the picture, but leave some margins on all sides.
  • Focus on the center of the image.
  • Use Landscape mode if working with horizontal barcodes (1D Barcodes and PDF417)

   NOTE:   This positions the barcode in the central portion of the camera’s image sensor.  This portion has the smallest out-of-focus and barrel distortions.

Motion Blur and Illumination

  • In camera settings: enable Image Stabilization (if available)
  • Maximize surface lighting but avoid glare or washout.
  • Avoid shadows from your hand or camera in the barcode area

  NOTE:  from http://www.pcmag.com/article2/0,2817,2383739,00.asp)

"Blurry images are often the result of slow shutter speeds. The longer the shutter is open, the longer the sensor is exposed and then even the steadiest hands will still inject a little blur in the photo. One feature I’ve yet to see in a cell phone camera is optical image stabilization, which reduces the chances of taking blurry photos. A camera with a mechanical stabilizer keeps the lens in the same position, so photos with slow shutter speeds have a better chance of not turning out blurry. Without image stabilization … shoot in a well-lit environment. The more light you have, the less time you have to expose the image sensor, which will decrease the amount of movement the sensor will experience. "

Flash

   Turn flash off.   Flash often create white glare on the picture.  This is caused by reflection form a glossy surface that is too close to camera. Use good ambient illumination.

Imaging  API Configurations

If you application controls the camera through an API, in addition to above settings:

  • Convert image to Grayscale to reduce file or compressed image size.

Optimizing process with an image viewer

To optimize your process analyze quality of acquired image use good image viewer with zoom capabilities. For example:

After opening an image file zoom on the barcode portion of the image.
Visually examine how clearly bars and gaps are separated. Quality and readability of the text next to barcode is a good indication of barcode readability.

ZOOMED barcode images below demonstrate results of such examination.

Readable barcode – good image quality

This is a good quality image. Bars and spaces are clearly identifiable. Text next to barcode is very clear and easy to read.

img_good.png

Unreadable barcode – blurring of the bars and spaces

This barcode’s bars and spaces are blurred. Some bar and spaces merged and can not be visually separated. Text next to barcode is very fuzzy. This is the most often encountered quality problem. Use recommendations above to improve barcode recognition.

img_blurred.jpg

Unreadable barcode – glare on the image

Target of this image has glossy surface. Light reflection create a glare making barcode and portion of the text unredable. To avoid this problem use defused ambient light. Do not use flash.

img_glare3.jpg

Unreadable barcode – very small picture

This barcode is a small portion of much large image. Looking at the whole image human eye detect presence of barcode. However barcode is so small that bars and spaces cannot be separated. If the human eye cannot read text next then the barcode is not readable as well. Barcode should occupy much large portion of an image and text close to barcode should be readable.

img_low_res.png

Similar quality is typical for images downloaded from the Web, that are scaled down for Web page presentation.