Posts Tagged ‘Barcode Recognition’

Enhancing Barcode Recognition

Friday, May 7th, 2010

The Pedias have been recognizing barcodes from images since back when the external iSight was the hottest new gadget. The code has withstood over the years and being open source has been used in several other projects. However, with the semi-newer Mac Book Pros that not only have a fixed focus iSight but also a lower capture resolution the code was not handling well. (All built in Mac iSights are fixed focus, impressively the iPhone 3GS does have focusing capabilities and hopefully these will make it to the Mac line in the future too).

One of our fellow developers, Chris Karr, decided to improve the situation and spent Christmas building a new recognition engine from the ground up.

His new code is built with the idea of incorporating my old version as well as new solutions in a structure that allows the insertion of different scanners for the same image and then pick from the best results. Chris is using OpenCV, an extensive image processing library, to handle his video and prepare the frames for scanning. I’ve been trying to improve on his results but have had little success in bettering his already impressive work using OpenCV to which I am not accustomed.

My original scanner works directly by accessing the incoming QuickTime buffer and I am no expert on video but working with QuickTime I’ve come to learn its ways as well as the UYVY native format. So I decided to blend the new and the old. I did this by taking some structure ideas from Chris (in order to clean up my code that’s looking a bit messy due to all the optimizations) as well as the new excellent barcode scanning library called ZBar that Chris is using as one of the scanners and keeping my Quicktime capture. With these changes I was able to improve the current version.

The result of all this mixing is for the moment a new impressive scanning engine for the Pedias. In the long run hopefully we’ll be able to bring all these improvements together with Chris’ version of the framework that is better structured for future improvement and make even further advancements. In the meantime if you’re looking for a scanning engine take a look at Zbar as it even has an iPhone project included in the source (the old barcode scanner code has been very popular with users wishing to port it to the iPhone, this new project will save developers a lot of work).

I want to thank both Chris Karr and Jeff Brown, the creator ZBar, for their work in building great tools for the Cocoa community.
Go ahead  and play with the latest Pedias and let us know if the iSight’s even more magical than before (now scans upside down codes as well).