当没有读取带有URL的QR码时,zxing QRCodeReader中的ChecksumException [英] ChecksumException in zxing QRCodeReader when NOT reading a QR-code with an URL

查看:416
本文介绍了当没有读取带有URL的QR码时,zxing QRCodeReader中的ChecksumException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我使用URL扫描QR码,以下代码可以完美而快速地运行。但是,如果我使用简单的字符串或数字序列解码QR代码(这是我想要做的),它有时会随机工作,但99%的时间它会因ChecksumException而失败。

The following code works perfectly and fast if I am scanning a QR code with an URL. However, if I am decoding a QR code with a simple string or number sequence (which is what I would like to do), it randomly works sometimes, but 99% of the time it keeps failing with a ChecksumException.

if (webcam.isOpen()) {

            if ((image = webcam.getImage()) == null) {
                continue;
            }

            LuminanceSource source = new BufferedImageLuminanceSource(image);
            BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));

            try {
                result = new QRCodeReader().decode(bitmap);
            } catch (NotFoundException e) {
                 //exception handling omitted
            } catch (ChecksumException ex) {
                //exception handling omitted
            } catch (FormatException ex) {
               //exception handling omitted
            }
        }

已以前有人经历过吗?可能是什么解决方案?

Has anybody experienced this before? What could be the solution?

BTW我用 http: //goqr.me/

推荐答案

这个问题实际上有点误导。数字序列失败的简单qr代码的原因是它们的模式更大,因为代码包含的信息较少。 URL QR码具有更多信息,因此具有更高的分辨率和更小的模式。问题的根源是我正在测试的网络摄像头对焦点问题(或色差,我不知道)非常敏感,因此低分辨率的QR码必须远离网络摄像头才能被读取以便阅读正确,而不是URL二维码...这个问题只有我的开发PC的华硕网络摄像头,我试过的所有其他网络摄像头基本上使用我的所有测试二维码。

This issue was actually a little misleading. The reason for simple qr codes with number sequences failing was that their patterns were bigger, as the code contained less information. URL QR codes had more information and thus a higher resolution and smaller "patterns". The source of the issue was that the webcam I was testing with was extremely sensitive to focus issues (or chromatical aberration, I do not know), so QR codes with low resolution had to be moved FURTHER away from the webcam in order to be read correctly, than URL QR codes... This issue was only this significant with my development PC's Asus webcam, all other webcams I tried basically worked with all my test QR codes.

这篇关于当没有读取带有URL的QR码时,zxing QRCodeReader中的ChecksumException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆