QRCode for .NET Compact Framework#

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.


Thursday, October 04, 2007 9:09:56 PM (Eastern Daylight Time, UTC-04:00) #    Comments [5]  | 

 

Got Game?#

Our September coding competition is now complete and the winner is FlowFx by Malcolm Hall.  Although it was the only entry I personally think it's a great entry and shows what developers can do with Windows Mobile and only the tip of the iceberg IMO.  Check out this product from ZenZui or the HTC Touch or the home screen of the Samsung SGH-i600 ... all very cool things you can do with the a Windows Mobile device!

So this month's theme ... gaming.   Check out the details on the community site and show everyone how much game you got!


Wednesday, October 03, 2007 11:02:59 PM (Eastern Daylight Time, UTC-04:00) #    Comments [0]  | 

 

Bitmap Pixel Access Using Compact Framework#

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 324x324 image was 12s):

for (int y = 0; y < height; y++)
{
    for (int x = 0; x < width; x++)
    {
        intImage[x][y] = image.GetPixel(x, y).ToArgb();
    }
}

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

unsafe
{
    BitmapData bd = image.LockBits(new Rectangle(0, 0, image.Width, image.Height),
        ImageLockMode.ReadOnly,
        PixelFormat.Format24bppRgb);
    int sourceWidth = image.Width * System.Runtime.InteropServices.Marshal.SizeOf(typeof(PixelData));
    if (sourceWidth % 4 != 0)
        sourceWidth += (4 - (sourceWidth % 4));
    Byte* bitmapBaseByte;
    bitmapBaseByte = (Byte*)bd.Scan0.ToPointer();
    PixelData* pPixel;
    for (int y = 0; y < height; y++)
    {
        pPixel = (PixelData*)(bitmapBaseByte + y * sourceWidth);
        for (int x = 0; x < width; x++)
        {
            intImage[x][y] = (int)((0xff << 0x18) | (pPixel->red << 0x10) | (pPixel->green << 8) | pPixel->blue);
            pPixel++;
        }
    }

    image.UnlockBits(bd);
}

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:


Saturday, September 29, 2007 1:19:45 AM (Eastern Daylight Time, UTC-04:00) #    Comments [0]  | 

 

DemoCampToronto14#

DemoCampToronto14 is happening this Sept 17 2007 and I'll be there.  What is DemoCamp? It's a variation of the unconference style of event where community members share what they've been working on, demo their products and meet others.  I won't be presenting anything but will be attending (OpenNETCF has also helped sponsor the event).  It's a great place to meet the people and see what cool things people are working on!  If you are in the Toronto area and attending (registration has sold out) drop by and say hi!  If we have never met here's what I look like :).


Wednesday, September 12, 2007 1:55:57 PM (Eastern Daylight Time, UTC-04:00) #    Comments [0]  | 

 

Windows Mobile/Embedded Developer Community Site#

Today we launched a new community site  focusing on Windows Mobile and Windows Embedded developer community called the OpenNETCF Community.  Here we will find a variety of articles/white papers geared towards Windows Mobile and Embedded developers.  This will also be the new home for our open source projects open source projects and we are in the process of migrating more over. (Neil talks about everything in more detail here).

If you are interested in writing white papers or have some projects you would like hosted let us know.  Also if there is anything else you want to see on the community site let us know.


Tuesday, September 04, 2007 4:39:56 PM (Eastern Daylight Time, UTC-04:00) #    Comments [0]  | 

 

All content © 2008, Mark Arteaga
Related Sites
Archives
Sitemap
Disclaimer

Powered by: newtelligence dasBlog 1.9.7174.0

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

Send mail to the author(s) E-mail

Theme design by Jelle Druyts