如何读取长“代码39”带有“Zxing”的条形码?
在我的应用程序中,我使用 Zxing
库来解码条形码。 “Motorola Xoom”和“Samsung”是目标设备。我为其开发此应用程序的公司在其产品中使用 Code 39
条形码。
Zxing 可以很好地解码短条形码,但是当我尝试解码较长的“Code 39”条形码时,它会继续尝试,但不会产生任何结果。为了图像清晰,我增加了扫描矩形区域,这对三星来说是成功的,但对摩托罗拉来说却不是。有什么方法可以让它适用于摩托罗拉吗?任何反馈都将受到高度赞赏。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常问题是最小焦距的差异。也就是说,如果摩托罗拉设备无法近距离对焦,那么加宽矩形可能会使用户将条形码靠得太近,以致于太近而无法对焦。我会先看看这个。
否则,您正在考虑改进这种情况下的图像处理。挑战在于该应用程序执行简单的阈值处理,这在常见情况下效果很好。当条码宽度接近 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.