Window Phone 7.5, ZXing and QR codes
QR codes appear to be appearing everywhere. From outside our favorite restaurants, to magazines, TV shows to even using them to communicate between Windows Phone 7 devices and the XBox and Kinect (see story)!
So how do we get this kind of magic into our apps? Jonas Follesø has got our back and shows us just that...
One of the big new features of Windows Phone 7.5 (code named Mango) is direct camera access. Having access to the camera stream enables several new scenarios, such as in-app QR and barcode scanning, augmented reality applications or custom looking photo camera UI. There are some good resources on how to use the new APIs to access the camera in Mango, but I haven’t found any complete examples of how to implement a QR code scanner, which is what I am going to do in this blog post.
When starting on the task of building a QR scanner one of the first things I did was to research different open source libraries to do the image recognition. Thankfully there are multiple libraries available, but the ZXing library from Google seems to be one of the most popular. The ZXing library is ported to multiple programming libraries, and supports a wide variety of 1D/2D codes (QR, Code128, Code39, EAN and many more). There is a C# port of the library, which has later been ported to Silverlight and Windows Phone 7. So the actual task of writing the QR scanner is to integrate the ZXing library with the Mango camera API.
The XAML code for the scanner consists of 4 main components. ...
The post continues on showing us a number of ins and outs in using ZXing and the WP7.5 camera API's.
Here's a snap of the Solution;
Note: That while the app runs in the emulator, it's pretty pointless since the emulator doesn't hook into any cams you might have...
Now that Jonas has shown us how, the rest is all downhill from here... (Actually now's the hard part, coming up with our own unique means of adding this magic to our app's... but you get the idea.)
Here’s a few more links you might find interesting:
- Windows Phone SDK 7.1 Release Candidate
- ZXing Library
- Windows Phone 7 Silverlight ZXing Barcode Scanning Library