Updated 2015-10-25 16:05:52 by dzach

zbar is a library for decoding barcode symbols. http://zbar.sourceforge.net/

zbar is provided as a tcl package together with Androwish. Documentation for the zbar tcl package can be found here.

In case someone wants to build zbar for Linux manually, chw provided the following instructions:

"chw 2015-10-24: Should be possible with the latest check-in http://www.androwish.org/index.html/info/c82e1d09884d0458. I've tested manually building it on a CentOS6 system with these commands:
    $ gcc -fPIC -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1 -DTCL_THREADS=1 -DPACKAGE=\"zbar\" -DPACKAGE_VERSION=\"0.10\" -c tclzbar.c
    $ gcc -shared -o libtclzbar.so tclzbar.o -lzbar -ltclstub8.5 -ltkstub8.5
    $ wish8.5
    % load ./libtclzbar.so Zbar

"

dzach 2015-10-25: To build zbar manually in a local directory (I had problems building it with autoconf), I brought the necessary files tclzbar.c and zbar.h in a local dir, and linked locally the /usr/lib/libzbar.so.0.2.0 lib (can also be copied) as libzbar.so. /usr/lib/libzbar.so.0.2.0 was installed earlier using:
    $ sudo apt-get install zbarcam

from Ubuntu's repositories.

Using chw's instructions from above, the compile/link command lines were modified to look for the files in the local dir:
    $ gcc -I`pwd` -fPIC -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1 -DTCL_THREADS=1 -DPACKAGE=\"zbar\" -DPACKAGE_VERSION=\"0.10\" -c tclzbar.c
    $ gcc -shared -o libtclzbar.so tclzbar.o -lzbar -ltclstub8.5 -ltkstub8.5 -L`pwd`

To use zbar as a TCL package, a pkgIndex.tcl file was created, with the following contents:
    package ifneeded zbar 0.10 \
        [list load [file join $dir libtclzbar[info sharedlibextension]] Zbar]

To test zbar, I took a photo of a barcode from an item, e.g. food package, named it barcode_test.jpg, and then entered:
    $ package require zbar
    0.10
    $ package req img::jpeg
    1.4.4
    $ image create photo test_img -file barcode_test.jpg
    test_img
    $ zbar::decode test_img
    81 EAN13 2220063011920 ; # this is the result: milliseconds, symbol type, barcode