We have been using Zbar in production in one of our desktop applications. In this we extract the barcode from the Image and use it. Though it is different from yours but the issue is the same where we extract the barcode from live stream.
The issue you are facing is very prevalent and error prone. And ultimately all depends on the picture. (In fact you will observe the same behavior with Zxing
, Eymbarcode
and other open source ones. The most stable one I found is this). Ultimately we had to resort to Image taking guidelines. The below are the quality factors we use to avoid it:
The following factors determine the detection ability of the application:
- Resolution
- Focus
- Lighting and Exposure
- Noise
Hence it is essential that all the above four are taken care of while the picture is taken.
Resolution: It would be desired that the barcode occupy significant portion on the Image. For long linear barcodes or dense 2-D symbols, one will probably have to increase the resolution. If the resolution decreases below two pixels, it will be hard to scan the barcode.
Focus: Blurred Images are highly undesired. Even a portion of barcode consisting of blurry part will lead to inability of detection.
Lighting and Exposure: An image that is too bright or overexposed can completely wash out any barcodes. An image that is too dark or underexposed will not provide sufficient contrast for the scanner. Low light levels also tend to produce noisier images.
Noise: Random variation of brightness/color can make it difficult to scan the barcode.
Angle: It would be preferred to have the barcode placed either horizontally or vertically placed.
Tilt: It would be preferred if the camera is placed perpendicular to the image.
The above does not solve your problems, but I hope it helps