Introduction of QR Code Reader Library
For people who want to use QR Codes within the Flash environment, LOGOSWARE (the company I work for) has released a QR Code Reader into the Spark Project.
It is essentially a library that recognizes and decodes any QR Code from any image source.
The QR Code Reader is made from 2 main Classes.
1. GetQRImage Class: recognize QR Code from any image
2. QRdecode Class: decode a QR Code to get string
Here is an introduction on how to get started.
1. GetQRImage:
// set DisplayObject contains a QR Code
getQRimage = new GetQRimage(imageSrc); // imageSrc:DisplayObject(Sprite, Video, ...)
// run onQrImageReadComplete when the QR Code is found
getQRimage.addEventListener(QRreaderEvent.QR_IMAGE_READ_COMPLETE, onQrImageReadComplete);
// begin recognition. you may run this every frame when the image source is viewed by a webcam.
getQRimage.process();
// invoked when QR Code is found
function onQrImageReadComplete(e:QRreaderEvent):void{
// e.data is a 2D bit array of QR Code
}
The bit array of QR Code obtained by GetQRimage can be decode by QRdecode Class.
2.QRdecode Class
// set 2D bit array of QR Code
qrDecode.setQR(e.data); // e:QRreaderEvent
// run onQrDecodeComplete when decoding is complete
qrDecode.addEventListener(QRdecoderEvent.QR_DECODE_COMPLETE, onQrDecodeComplete);
// begin decoding
qrDecode.startDecode();
// invoked when decoding is complete
function onQrDecodeComplete(e: QRdecoderEvent):void{
// e.data is the string decoded from QR Code
}
Below is a sample of the flash application and a QR Code. If it doesn’t work, please check the following.
- Is the webcam connected to your computer?
- focus the webcam
- set the webcam center, directly viewing the QR Code, and move it back and forth

Both Classes support QR Code of Model Two, Version 1-10 and all levels of Error correction.
If you have any comments or questions, please post them here or e-mail me directly.
keno42 [at] gmail [dot] com
I think the GetQRimage Class has many points to be improved upon (e.g. It is currently using a global thresholding, but an adaptive thresholding may increase recognition rate).
I will keep updating these points and then submit them to the Spark Project.
—
QR code (R) is a registered trademark of Denso Wave Incorporated.
13 Comments
[...] QR Code Reader Library by Kenichi Ueno Introduction of QR Code Reader Library Kenichi UENO: For people who want to use QR Codes within the Flash environment, LOGOSWARE (the [...]
This doesn’t work for me. I’m using a Mac with a built-in iSight camera. Would that be a problem?
Stuart: Some webcam would be a problem for following reasons. 1.It can’t focus in closeup, 2.It has a large distortion, 3.It has many moire stripes.
Although, improvement of the recognition Class would get rid of some of these. If you sent me the screenshot, it would be a help.
Thank you.
Sorry, should’ve been more clear. Even after clicking “allow”, the camera doesn’t activate, the box is just grey.
Oh OK, please confirm that other application is not using the camera at the same time.
No, nothing else at all I’m afraid. If you need me to test any updated builds, please just email!
Kenichi, thanks, that’s really cool.
I test and work good,
I just notice the recognition take some time or maybe was the focus for my camera -distortion-
By the way, I noticed too that the return string when I encoded Latin characters like á ó or German umlaut like Ü ö ä ß are not property represent.
that ’s can be the encoding UTF8 … I will check more deep your sample and code.
again thanks for share it
Best,
guillermo
[...] JActionScripters » Blog Archive » Introduction of QR Code Reader Library For people who want to use QR Codes within the Flash environment, LOGOSWARE (the company I work for) has released a QR Code Reader into the Spark Project. [...]
Guillermo, thank you for trying this library.
The original QR code does not support UTF8. It has only 4 modes of encoding – numbers, alphabets and numbers, a 8-bit byte and Kanji characters(shift-JIS encoding).
I have no idea if the QR code encoder customized to use UTF8 encoding instead of shift-JIS encoding even exists. But if you already have such encoder, it is not so difficult to make a customized version of decoder. The encoding of Kanji characters is written in lines.351-363 of QRdecode.as.
[...] QRCodeReader by LOGOSWARE – A library to recognize and decode QRCode in specified image. [...]
The idea of having 2d barcode recognition available to a flash app is awesome, but the detection seems a bit sub par. It seems that if there is any skew to the code at all, or not filling up all of the are within the guide lines, it’s almost useless. If the recognition time can be bumped up and it’s less finicky, I’d love to implement it in a project.
[...] ちなみにJActionScripterに書いた英語版の紹介記事はこちら。英文のネイティブチェックはSimon氏にやってもらいました。thx! [...]
[...] Developer for Logosware Software, Kenichi Ueno has released a library into the Spark Project (an open source community to develop Flash/ActionScripts) that recognizes [...]