我目前正在开发一个扫描器读取一个图像中发现多个QR码一个图像读取多个QR码。 我设法读取图像中的QR码,但它给我不一致的结果。假设图像中有4个QR码,有时我可以读取2个,有时可以读取3个,也可以只读1.与原始扫描仪(ZXing扫描仪)不同,它可以快速解码。在我的情况下,我必须确保有足够的光线,并且图像没有模糊来解码。如何使用斑马线库
我使用的QRCodeMultiReader
对图像进行解码。目前使用ZXing
库来创建应用程序。
下面是我的代码片段:
public void onPictureTaken(byte[] data, Camera camera) {
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inMutable = true;
Bitmap bitmap = BitmapFactory
.decodeByteArray(data, 0, data.length, opt);
Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>();
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
LuminanceSource source = new RGBLuminanceSource(bitmap);
QRCodeMultiReader multiReader = new QRCodeMultiReader();
Result[] results = multiReader.decodeMultiple(new BinaryBitmap(
new HybridBinarizer(source)), hints);
}
有你发现任何完美的解决方案,以读取多个条形码?/ – 2014-06-23 08:16:30
不幸我不是因为我们停止了该功能的开发。但将继续寻找解决方案,尤其是我回到了android。 – 2014-06-24 00:37:17
好吧,你可以分享我代码你以前试过的吗? – 2014-06-24 04:57:57