ZXing在Android上 - 解码性能极其缓慢

jus*_*iba 4 android qr-code barcode-scanner zxing

正如标题所示,我正在尝试使用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();
}
Run Code Online (Sandbox Code Playgroud)

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

我尝试过使用MultiFormatReaderQRCodeReader.

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

jus*_*iba 8

事实证明,附加到应用程序的Android调试器会使性能大大降低.在HTC Desire HD上扫描完整相机帧图像所需的大约时间大约需要150ms - 200ms.愚蠢的错误对我而言.