Hey guys!! I’m excited to announce two packages that I’ve recently completed as main works of the OSPP’22 project.
-
QRCoders : GitHub - JuliaImages/QRCoders.jl: Creating QR Codes within Julia
-
QRDecoders: GitHub - JuliaImages/QRDecoders.jl: OSPP'22 project repository for QR format decoder support
Features of QRCoders
QRCoders.jl is a rewrite of QRCode.jl that was discussed here before.
The latter provides a very nice sketch of realization, but has defects with correctness and performance. So I correct these errors and provide a more flexible and efficient implementation, with the help of @johnnychen94.
Here are examples of version 1 and 40(max version) respectively.
using BenchmarkTools
using QRCoders: qrcode
using QRCode:qrcode as orgqrcode
mat1 = @btime qrcode("Hello world!"; compact=true);
mat2 = @btime orgqrcode("Hello world!"; compact=true);
mat1 = @btime qrcode("Hello world!"^190; compact=true);
mat2 = @btime orgqrcode("Hello world!"^190; compact=true);
Benchmark results:
repo | version | cost |
---|---|---|
QRCoders.jl | 1 | 149.392 μs (370 allocations: 32.28 KiB) |
QRCode.jl | 1 | 4.040 ms (175888 allocations: 8.43 MiB) |
QRCoders.jl | 40 | 21.700 ms (29459 allocations: 4.84 MiB) |
QRCode.jl | 40 | 509.677 ms (19128212 allocations: 922.52 MiB) |
As shown above, the memory is about 200 times less than the original one, and the time-cost is about 30 times less. In fact, almost all functions are rewritten to achieve this.
Features of QRDecoders
First and foremost, two algorithms are implemented for error correction:
The first one is written with optimized performance (benchmark results comparing with other decoders will be added in the later works).
Future works
The Berlekamp-Massey algorithm needs more tricks in detail. We might optimize the performance in the future, while there are some more worthwhile works.
For image processing, the decoder can only deal with standard QR image. The next plan is to enhance the image detecting ability, so that it can deal with more complex cases.
There are much more to do with QRCoders.jl as well. For instance, the QR code style has a creative room that beyond one’s imaginations, like
- Add logo as mentioned in the issue
- Unicode plot mentioned in the issue
- Draw a picture in the QR code, for example, video of Bad apple!! (see BadAppleQArt-Github(C#) and bilibili)
This is the first package that I developed, and it goes well smoothly thanks to @johnnychen94.
Look forward to feedback and suggestions, and feel free to criticize or discuss.