Android 中 zxing 未发现异常
大家好,
如果你们中有人可以帮助我。我正在使用 zxing 解码 barCode 图像,但它返回 com.google.zxing.NotFoundException,不知道为什么。相同的图像通过提供给 zxing 的 Intent 进行解码,但当我使用它从图像文件解码时则不会。
我正在使用的代码如下:
mMultiFormatReader = new MultiFormatReader();
mMultiFormatReader.setHints(null);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(new RGBLuminanceSource(path)));
Result result = mMultiFormatReader.decodeWithState(bitmap);
Hello everyone,
If any one of you can help me this. I am using zxing to decode barCode image, but it returns com.google.zxing.NotFoundException, don't know why. The same image gets decoded via Intent provided to zxing, but not when I use it to decode from image file.
The code that I am using is below :
mMultiFormatReader = new MultiFormatReader();
mMultiFormatReader.setHints(null);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(new RGBLuminanceSource(path)));
Result result = mMultiFormatReader.decodeWithState(bitmap);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不认为这是完全相同的图像,因为你不能让它通过 Intent 扫描文件。我假设您的意思是您可以很好地从屏幕上扫描图像,但图像本身无法解码。
这就是生活,真的。有些图像无法解码。但您可以尝试 TRY_HARDER 模式或使用不同的二值化器来查看是否有效。
I don't think it's exactly the same image, since you can't have it scan a file by Intent. I assume you mean that you can scan the image off your screen fine, but the image itself does not decode.
That's just life, really. Some images won't happen to decode. But you may try TRY_HARDER mode or use a different binarizer to see if that works.