3

In my application I am using Zxing library for decoding barcodes. "Motorola Xoom" and "Samsung " are the target devices. The company for which I am developing this application uses Code 39 barcodes for their products.

Zxing decodes short barcodes fine, but when I try to decode lengthy "Code 39" barcodes it keeps on trying but produces no result. For image clearance I increased the scanning rectangle area which proved successful for Samsung but for Motorola it is not. Is there any way by which I can make it work for Motorola? Any feedback will be highly appreciated.

CharlesB
  • 86,532
  • 28
  • 194
  • 218
Abdul Rehman
  • 373
  • 6
  • 15

1 Answers1

1

Often the problem is a difference in minimum focal distance. That is, if the Motorola device can't focus as closely, then widening the rectangle may make the user hold the barcode so close as to be too close to focus. I would look at this first.

Otherwise you're looking at improving the image processing for this case. The challenge is that the app does simple thresholding, which works well in common cases. It falls down when you have dense 1D barcodes whose bar width nears 1 pixel. Because each pixel is either black or white you lose proportionally a lot of detail about exactly where the bars are.

If that's really the issue you could look at rewriting your app to use a full-resolution capture from the camera, instead of preview. In normal cases, more resolution doesn't help; in these cases it might. You would not be able to have a continuous-scan app this way.

I am one of the Barcode Scanner devs, and maintain a (for-pay) enhanced version called Barcode Scanner+. It has a different image processing algorithm that finds boundaries at sub-pixel resolution, which works better for codes like these. You may want to see how it does -- and if that works well, at least that tells you the kind of approach that works better. I can't send you that code but can describe what it does, if you want to investigate that sort of image processing.

Sean Owen
  • 66,182
  • 23
  • 141
  • 173
  • Hi Sean, Thanks for such a detailed response. _If that's really the issue you could look at rewriting your app to use a full-resolution capture from the camera, instead of preview._ What I get from this is, You want me to scan **barcode** using full camera preview instead of using scanning rectangle of specified height and width. If this is so, I have tried it too. But this too was not working in case of Motorola. Also, I cannot move to any other solution for reading **barcode** as the prototype has already been released and I cannot change it now, but only can enhance it. – Abdul Rehman Nov 17 '11 at 04:51
  • No I mean use the APIs to capture a picture, which has 100x more pixels than the preview. I don't know if it would make a difference. It's entirely different -- you can't make a continuous-scan app this way for example. It would be a point-shoot-scan model, like Goggles. – Sean Owen Nov 17 '11 at 08:20
  • I have the same issue. Specifically I need to read a VIN number. I increased the scanning rectangle width without luck. I shrunk the scanning height hoping less pixels = more processing. I also tried calling InitiateScan() and passing in a singleton collection containing CODE_39 so that the application would not have to figure out what I was asking it to scan. Has anyone made these modifications to ZXing to make it use a full resolution scan? – Paul Jul 09 '12 at 13:46
  • I have tried till resize scanning rectangle but frankly speaking have no idea of the function **InitiateScan()**. The solution I adopted later on was the implementation of events provided by **onTouchEvent()**. This helped a bit as user was able to resize scanning rectangle and adjust it in a way that scanning area pixels can be made less noisy and hence result can be retrieved. Changing rectangle size on the run increases probability of reading bar code successfully may be after trying 2 or 3 different resolution than trying with same resolution and waiting for minutes. – Abdul Rehman Jul 10 '12 at 14:43