BinaryEye icon indicating copy to clipboard operation
BinaryEye copied to clipboard

Improving QRCode Decoding on non-ideal images

Open Sergio- opened this issue 2 years ago • 4 comments

Hi Folks, Good day. I hope you're doing great! I'm posting this in the issues section as I didn't find any other place to ask it. I'm researching on how to improve the QR Code decoding performance for cases where the image have some imperfections. I'm comparing several libraries for this use case. BinaryEye is a phenomenal App. I love it and its far superior that most of the other ones that we have around. Thanks Markus Fisch. However, there's some cases where I'm still struggling to have it decode QR Codes. Take the attached one for example. It's a QR Code that is decoded fine using a standard USB Reader. I've also tested it with a proprietary Demo Library (dynamsoft) which, surprisingly, decodes it very easily. Unfortunately, being proprietary and with an unreasonably high price make it non affordable for most cases. Two questions comes to mind:

  1. How this proprietary library can decode that image and most of other don't? What kind of "magic" do they do in order to improve the performance?
  2. Is there any way we can achieve same results with BinaryEye (or ZXing-cpp)? Is there a way to pre-process the camera image (with brightness/contrast or color threshold filters for example) or change any App/Library parameters that can yield to same results? I'm pasting the same image I used on the attached video for testing. I Appreciate if any of you guys have suggestions on how to improve decoding performance for these scenarios. Thank you and Best Regards.

The tests were done on the Galaxy Note 20 Ultra, with Binary Eye 1.57.0 from F-Droid App Store.

image

https://user-images.githubusercontent.com/3593635/209444584-a3189fbe-dc7e-4417-a5ad-ef0735e76e3c.mp4

Sergio- avatar Dec 24 '22 16:12 Sergio-

Have you tried manually pre-processing the image in photoshop to see if that would actually help with the readability? If it does, then we can see about trying to implement a pre-processing (if it's not already present in the reader lib, haven't checked). If not, it's some other kind of magic.

BloodRaven0 avatar Dec 25 '22 11:12 BloodRaven0

Hi @BloodRaven0 Thanks for the feedback. Yes, I actually did some basic processing steps using GIMP and managed to get the same barcode decoded by BinaryEye, See details below: Screenshot from 2022-12-25 23-38-58

Sergio- avatar Dec 26 '22 02:12 Sergio-

Well, I think this is probably really more an issue for ZXing C++. And it might me related to https://github.com/markusfisch/BinaryEye/issues/324.

In more detail, I think the thresholding algorithm ZXing C++ is using (see HybridBinarizer.cpp) doesn't work too well for these samples. Of course, this can and should be improved, and I'm already working on it.

So to answer your questions:

How this proprietary library can decode that image and most of other don't? What kind of "magic" do they do in order to improve the performance?

There are many thresholding algorithms and some of them work better for this kind of situation. But it's always a balance between speed and precision. A thresholding algorithm for live image processing must be as fast as possible and so may not be as precise.

Is there any way we can achieve same results with BinaryEye (or ZXing-cpp)? Is there a way to pre-process the camera image (with brightness/contrast or color threshold filters for example) or change any App/Library parameters that can yield to same results?

The way to go would be to improve the thresholding algorithm in ZXing C++. It is possible to do some pre-processing in Binary Eye, but this wouldn't be as performant as doing it in the library.

markusfisch avatar Dec 27 '22 14:12 markusfisch

Hi @markusfisch Good day. Thanks a lot for the reply and feedback. I've started a discussion on ZXing-CPP repo regarding improving the detection, here's the link. https://github.com/zxing-cpp/zxing-cpp/discussions/398. The post here has more details, I'm preparing another set of test and I'll post on the ZXing-CPP discussion. Hopefully it will be possible to implement some of this techniques on the library itself and improve the overall performance. Thanks a lot. I Appreciate your contribution on the discussion there. Best Regards.

Sergio- avatar Dec 28 '22 17:12 Sergio-