Archives For QRCodeCF

In my previous post I left a hint on a new project I was working on which was this image:



After reading about Windows Live Barcode and seeing it was not available  at barcode.ideas.live.com I decided to look around to see if there was something available for .NET CF to create an application to decode these images on a Windows Mobile device using the built in camera.  Nothing was available except this JavaME implementation here.  So I ported that code to C# and now we have QRCode Library for .NET Compact Framework.


What is a QR Code?  Well, it is a two-dimensional barcode that should be decoded at high speeds.  QR stands for ‘Quick Response’.


The image above was my test image (generated here) and here is the result running it on a Windows Mobile 5 device:


DoesItWorkWM5


So my question was answered and it does work.  Next test was testing with an image using the CameraCaptureDialog to see if the library can decode an image taken with a device camera.  Here is the image:


CameraImage


And here is the result:


CameraImageWM5


Although this was pretty exciting to be able to decode an image taken by the camera on the device (yes I think that’s exciting 🙂 it did take me about 5-7 tries before the image was actually decoded.  It wasn’t until I changed the JPG Quality to ‘SuperFine’ was the image decoded.  So IMO for the regular user I don’t think it’s ready for ‘prime time’.  Now my camera is only 1.3 mega pixels but new devices with 3.0 mega pixel cameras are now out which should help improve the image quality and the decoding success rate (time to upgrade my device!).


Another exciting part was decoding the image was pretty fast after the change I made I discussed in my previous post


So if you are interested in the project you can find all details here.  It is open source and we have added the source to our SVN Repository (main page is not updated but you can browse the source code).


BTW … if you want to generate an QR Code using a web service check out Richard Jones post here.

I’ve been working on a new open source project this past week and had a requirement to get ARGB value of every pixel in the image.  I thought ‘OK easy, just use Bitmap.GetPixel()‘!  At first I was using small images so there was not a problem, but as the size of the image increased, the performance of the application just dropped!


After a little bit of digging around I found the answer right under my nose!  Rob Miles recently wrote an article on Image Manipulation in Windows Mobile 5.0 for the OpenNETCF Community site.  The section that stood out to me was ‘Speeding up Bitmap Access’.  I took the techniques he showed in the article and implemented them in my code.  The result was an average savings of 11.5s to grab the pixel ARGB values.


Here is the original code (average for time for a 324×324 image was 12s):


And here is the new code (average for time for a 324×324 image was 0.5s):


By using unsafe block and directly accessing the bitmap data in memory we save a huge 11.5s on average.  If you want a more detailed explanation on how the code works read the article


For those interested here is the image I was testing with: