ZXing on Android - High Decoding Performance
As the name suggests, I am trying to decode QR codes on an Android device using the ZXing Barcode Scanner app. I read several threads on the internet about how it is not recommended to integrate an application into one own project. Should be used instead IntentIntegrator
.
However, this is not an option in my case. Below is the code snippet I am calling for each 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 5 to 8 seconds.
I have tried using both MultiFormatReader
and QRCodeReader
.
Can anyone shed some light on this topic?
source to share
The decoding performance will also depend on the speed of your phone. For a given phone / tablet, performance will not increase beyond a certain point because this library is running on ARM / ACPU.
You may need to work on optimizing your application. In addition, you can:
-
Use the washing method so that the flows are different.
-
Try to feed the image at a low resolution, so image processing does not take up much space.
-
Maintain an even tilt or try to keep a parallel plane between the phone and the barcode sticker / printed page.
source to share