正如标题所示,我正在尝试使用ZXing的Barcode Scanner应用程序在

Android设备上解码QR码.我已经在互联网上阅读了多个关于如何不鼓励将应用程序集成到自己的项目中的线程.相反,应该使用IntentIntegrator.

但是,在我的情况下,这不是一个选项.下面是我要为每个相机框架调用的代码片段.

LuminanceSource source = new RGBLuminanceSource(bitmap);

BinaryBitmap bm = new BinaryBitmap(new HybridBinarizer(source));

try {

Result result = reader.decode(bm); // This line takes approx. 6seconds

if (!result.getText().isEmpty()) {

Log.e("MYTAG", "Found something: "+result.getText());

}

}

catch (NotFoundException e) {

e.printStackTrace();

} catch (ChecksumException e) {

e.printStackTrace();

} catch (FormatException e) {

e.printStackTrace();

}

正如我所说,这个过程非常缓慢.解码需要5到8秒之间的任何时间.

我尝试过使用MultiFormatReader和QRCodeReader.

任何人都可以对这个问题有所了解吗?

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐