As the title suggests, I am trying to decode QR codes on an Android device using ZXing's Barcode Scanner app. I have read multiple threads on the internet about how it is discouraged to integrate the app within one's own project. Instead, one should use IntentIntegrator
.
However, this is not an option in my case. Below is a snippet of code which I am calling for every camera frame.
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();
}
As I said, this process is extremely slow. Decoding takes anywhere between 5 to 8 seconds.
I have tried using both the MultiFormatReader
and the QRCodeReader
.
Can anyone shed some light on the subject?
Turns out that the performance suffers greatly with the Android debugger attached to the application. Approximate time taken to scan a full camera frame image on an HTC Desire HD takes around 150ms - 200ms. Silly mistake on my part.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With