Apr 6, 2009

Zebras on my Eclipse RCP

I have been working to create a MIDlet demo application that demonstrates a web hybrid application using eSWT’s  Browser. My initial idea for the demo was simple, using the camera on the phone, MIDlet would scan a barcode for a book and gather and  display information with JavaScript on the eSWT’s Browser. Unfortunately, things did not go as I have expected. Although the camera integration works pretty good on eSWT as I have explained on my earlier post. The multimedia API on Nokia S60 does not implement the necessary stuff for focus control so it is not possible to focus enough to barcode and get a clear picture. To cut a long story short, I had to change my demo so that it does not need barcode scanning. It is still using the camera, but this time it integrates with Flickr using JavaScript on the Browser. There are many cool details to this application and I will have posts on this demo application later.
However I have become familiar with a very useful library called zxing (Zebra Crossing) while working on the original idea. It is an image processing library for 1D/2D barcode images. It supports all the major barcode formats and recognizes them magically. Since zxing is originally targeted for mobile phones it is a very small and good performing library.
Since I found this library amusing next thing for me was to create an RCP application that is capable of recognizing barcodes. So I have turned the zxing into an OSGi bundle, also implemented a piece so that it can work with SWT/eSWT images as well. The bundle can now be readily used both on Eclipse RCP and eRCP applications including Sprint’s Titan.
The next step was to use a library so that I can use the camera attached to my PC to capture images and scan the barcode. I have used Java Media Framework(JMF) API to do the job. Although the API is big and complicated once you understand the API (which takes hours of reading) it does the job. I have also created an OSGi bundle out of JMF but since the API requires native code and some initialization/installation step, I still need to work on it to make it work smoothly.Screen shot from bar code scanner application
As you can see from the above screenshot my RCP application is an experiment to prove that it works. Overall, I am satisfied with my home made barcode scanner application and even started to make plans for creating a library application for the family library (or the automatic shopping list application my wife has been asking for).

UPDATE: Code for this application is now publicly available, see details on this post.