zebra project logo

Zebra Barcode Reader

The zebra barcode reader is a small, layered EAN/UPC and Code 128 bar code scanning and decoding library implemented in C (C++ wrappers are also provided)

The library comes with two linux application front ends for:

where can i get it?

Download the latest zebra release

zebra sourceforge project page

getting support

Post a message in the "Help" forum if you just have a question or comment.

Check on the wiki for related information. Or contribute something that others might find useful.

If you have trouble decoding an image, you may attach it to a new support request.

Refer to the API documentation to integrate a barcode scanner with your project

why another barcode reader?

There are scores of commercial and shareware programs that scan many different symbologies, but the few open source image scanners I was able to find didn't meet my needs. This project aims to create a stable, robust library component that can be easily reused in a variety of applications. (and most importantly... "it sounded like fun at the time" :)

The advantages of the zebra implementation are:

However this is not intended to be a "solve all" implementation - a few of the main disadvantages:

but these don't keep it from being very useful for tracking movies, music, books, etc using your webcam or homemade wand scanner =)

implementation details

A common design for a bar code "image scanner" is to apply digital image processing techniques to an image containing a bar code: exact details vary, but this usually involves several filter steps to cleanup noise, sharpen and enhance contrast, edge detection and shape analysis to determine symbol location and orientation, etc. Finally the data is extracted from this pristine image. All of these processing stages require CPU cycle and memory resources and are often sensitive to various "filter parameter" configurations which are difficult for end-users to understand and setup.

The zebra library takes an approach closer to that used by "wand" and "laser" scanners: EAN/UPC bar code symbols are designed for very flexible scanning, they can be partially decoded in sections and the relative position and orientation determined after decoding. Taking advantage of this, the zebra applications make multiple scan passes over an image, decoding and assembling partial symbols on the fly. The effect is similar to the pattern you see from the laser scanner when you check yourself out.

Taking a cue from modern processing paradigms, zebra further abstracts this idea into a layered streaming model. Processing is separated into independent layers with well defined interfaces, which can be used together or individually plugged into any other system. A high-level description of the modules is provided here:

zebra processing pipeline
video input
Abstraction of a video device which produces a stream of images for scanning. The current release has interfaces to video4linux (versions 1 and 2). Eventually support will be added for DirectShow (Windows)
output window
Simple abstraction of a display output window that can present a scanned image to the user and accept input in response. To maximize fliexbility, the window may be opened and owned by the library, or attached to an application managed window embedded in a GUI. The current release supports basic X11 interfaces (XVideo and XImage). Eventually support will be added for DirectShow (Windows).
image scanner
Makes scan passes over a two-dimensional image to produce a linear stream of intensity samples. The input images may come from the video input module, or any external image source (such as an image file output by a flatbed scanner or digital camera). This module also implements the optional inter-frame consistency heuristic applied to a video stream.
linear scanner
Scans a stream of abstract intensity samples to produce a "bar width" stream. The intensity samples could be pixel values from the built-in image scanner, pixel values from an alternate external image scanner, or even raw sensor samples from a "decoderless" wand or laser sensor. The bars are detected and measured by applying some very basic 1D signal processing to the input sample stream
decoder
The decoder searches a stream of bar widths for recognizable patterns and produces a stream of completely decoded symbol data. The current release implements decoding for EAN-13, UPC-A, and Code 128 symbologies. Support is planned in the near future for EAN-8, Code 39, and EAN add-on symbols. Support is planned eventually for PDF-417 and remaining EAN/UPC variations
processor
One potential drawback of a completely independent modular approach is that it can take some coding to tie all of the modules together, complicating even simple applications. The high-level "processor" module connects all of the other modules to flexibly support many common uses. For example, this makes it easy to pop up a window (or not) and scan for barcodes from video or image sources with very few lines of code. The included sample applications: zebracam and zebraimg are two examples of how this can be done (UTSL).
widgets (TBD)
Support is eventually planned for ready-made "widgets" in various popular toolkits (GTK, Qt, etc). These widgets will make it even easier to integrate barcode scanning capability into any application written using those libraries
plugin
Support has been started for a NPAPI (Mozilla) plugin, which is supported by Mozilla browsers and OpenOffice.org (among others)

SourceForge.net Logo
spadix@users.sourceforge.net

Copyright 2007-2008 (c) Jeff Brown - All Rights Reserved.

Verbatim copying and distribution of this entire article are permitted worldwide, without royalty, in any medium, provided this notice, and the copyright notice, are preserved.

Last modified: Tue Mar 4 15:31:27 EST 2008