She*_* GM 17 android qr-code zxing android-camera
我目前正在开发一种扫描仪,可以读取一张图像中的多个QR码.我设法读取图像中的QR码,但它给了我不一致的结果.假设图像中有4个QR码,有时我可以读取2个,有时3个或仅1个.与原始扫描仪(ZXing扫描仪)不同,它可以快速解码.在我的情况下,我必须确保有足够的光线,图像不会模糊解码.
我正在使用它QRCodeMultiReader来解码图像.目前正在使用ZXingLibrary来创建应用程序.
以下是我的代码片段:
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);
}
Run Code Online (Sandbox Code Playgroud)
您好,请检查 Zxing 条码扫描仪应用程序,它在“设置”中具有扫描批量条码的选项,因此您启用它并检查它,您可以一次从一张或多张图像中读取多个 QR 码,并检查 Zxing 库的源代码以了解详细信息。
https://code.google.com/p/zxing/
| 归档时间: |
|
| 查看次数: |
16422 次 |
| 最近记录: |