Intel Edison + webcam = barcode scanner

Original author: Matthias-hahn
  • Transfer
Everyone is already used to the fact that any mobile phone can scan barcodes. What about Intel Edison? In fact, everything is quite simple: just get a webcam and suitable software.


Linux barcode API


There are some excellent open source Linux libraries for working with barcodes. Among them, for example, zxing (license Apache 2), and ZBar (license LGPL 2.1.). When choosing a library, it should be noted that zxing was originally written in Java, and ZBar has a C-implementation that allows you to do without the Java runtime. We will use the ZBar.

Intel Edison and USB Webcams


Fresh Yocto images for Intel Edison have drivers for UVC USB cameras . That is, it’s enough to connect a compatible camera to the device and it will be possible to work with it. In order to use cameras of other types, for example, those with which the gspca module supports , you may need to build the appropriate driver yourself.

Zbar


We need ZBar for working with real-time video and with still images. For the latter, you will need ImageMagick libraries , which, together with all the dependencies, can be installed from repo.opkg.net by following these instructions . Namely, it is done like this:

# opkg install imagemagick_dev
# wget http://sourceforge.net/projects/zbar/files/zbar/0.10/zbar-0.10.tar.bz2
# cd zbar-0.10
# ./configure --without-qt --without-gtk --without-xv --without-xshm --with-imagemagick --with-x=no --prefix="/usr"

And please check if the detected configuration meets your expectations.

X                 --with-x=disabled
pthreads          --enable-pthread=yes
v4l               --enable-video=yes
jpeg              --with-jpeg=yes
Magick++          --with-imagemagick=yes
Python            --with-python=yes
GTK+              --with-gtk=no
        => the GTK+ widget will *NOT* be built
Qt4               --with-qt=no
        => the Qt4 widget will *NOT* be built

Unfortunately, the parameters are libtoolnot fully operational. Therefore, the call makeends with an error message. In order to complete the compilation and install what you need, I had to look for a workaround:

# rm libtool
# ln -s /usr/bin/libtool libtool
# make
# make install

If you do not have it installed usr/bin/libtool, the package you need can be found at repo.opkg.net .

After successful installation, it will be possible to detect a couple of binary files located at /usr/bin/zbarimgand /usr/bin/zbarcam. Zbarimg recognizes barcodes by processing image files. Zbarcam is looking for barcodes in video streams:

# zbarcam --nodisplay


Summary


As you can see, Intel Edison is easy to equip with everything you need to work with barcodes. And if you also add OpenCV here, you can combine it with ZBar in order to prepare images before recognition.

Also popular now: