QR Code Encoder/Decoder
Jiro‘s pick this week is QR Code encode and decode by Lior Shapira.
On October 31, we held our biggest annual event of the year, the MATLAB EXPO 2017 Japan. This year, I took part in organizing a couple of new sessions: a Lightning Talk session around fun/hobby uses of MATLAB, and a MATLAB Coding Contest.
As part of these sessions, I wanted to make use of the QR code (which encoded the registration ID number) that each attendee was given. For the lightning talk, I needed to quickly capture the IDs of the audience to do a drawing at the end for prizes. For the coding contest, I needed a way to capture the IDs of the players to keep score.
This is what the EXPO participants had hanging around their necks.
im = imread('qr_example.jpg');
imshow(im)
Rather than try to detect and do OCR on the ID number, I figured it would be easier to try to read the QR code. So, how do I read a QR code? Well, my colleague, Takeyoshi, took on the challenge to do that. After searching the web to find the encoding/decoding specs, he put together a nice function that used Lior’s entry on the File Exchange. The entry is a wrapper around a Java library ZXing, and we were pleasantly surprised at the accuracy it gave.
% Add java path javaaddpath('core-3.3.0.jar') javaaddpath('javase-3.3.0.jar') str = decode_qr(im)
str = '10007'
With a little bit of modification, I was able to create an ID Scanner for the purpose of the EXPO sessions.
Comments
Give it a try and let us know what you think here or leave a comment for Lior.
- 类别:
- Picks
评论
要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。