First of all, can your App recognize the following QR code?

If the scan function is based on ZXing and ZBar, and there is no custom processing data, the probability is not good. At this point, you can try Google’s library:

  • Scan Barcodes with ML Kit on Android
  • Sample: ML Kit Vision Showcase App with Material Design()

Result screenshot:


Here are my problems and thought processes

Today I received a task to optimize the scanning code and received the following TWO-DIMENSIONAL code (the one above):

Scan code is poor I know, just use ZXing this library, in most cases can be swept out, but with the naked eye visible gap with super App (such as wechat, Alipay have successfully identified the above TWO-DIMENSIONAL code).

After kneeling on the above QR code, I unkindly tested some apps that don’t rely primarily on scanning codes, and found that they all knelt as well…

Hammer’s camera. – No QR code

Netease Cloud Music (versionCode=8000041)

Get the App (versionCode = 20201231)

Today’s headlines (versionCode=8090) – Only occasionally can success… Sorry universe Factory, it’s just a coincidence

Finally, ZXing’s official App(versionCode=108) also failed…

So began to search for some solutions, for the image to do some intermediate processing, the processed data ZXing is easier to identify. Seeing this, I did not immediately start to do something, but began to think of another question:

Who should solve such a problem?

Application layer programmers really want to study image recognition, two-dimensional code principle these?

With these problems in mind, I searched the solution of wechat, and found that wechat has done a lot of processing for the whole code scanning process. Moreover, this article was written in 2016, and I heard that the current wechat code scanning uses machine learning technology (on second thought, image recognition may be the most suitable scene for machine learning). In addition, wechat Ali’s scheme is closed source (of course, they do not have any obligation to open source), Tencent cloud has a product called intelligent scan code, thinking of the company left 100,000 an application of the authorization fee, I continue to search…

. After a long time (maybe half an hour),

I found the Google solution mentioned at the beginning of the article. As one of the machine learning applications, THE ML Kit project includes a barcode-Scanning module. The project is still relatively new, init is only six months old, but the theory of machine learning-based image recognition technology is very mature. For specific usage, please refer to Guideline and Sample, as mentioned above, and the result is rapid and successful identification:

This may be the first time THAT I truly realized the power of machine learning. Remembering Han Han’s article “I also knew nothing about this Power”, machine learning has shown its advantages in many aspects. Thanks to Google, I can share the benefits without knowing anything about machine learning, but…

If there were no Google and only big domestic companies (again, they are not obligated to open source),

Will the age of machine learning accelerate fairness or differentiation?