Barcode Scanner with webcam on Intel Edison board

Published Date
17 - Dec - 2015
| Last Updated
17 - Dec - 2015
 
Barcode Scanner with webcam on Intel Edison board

With barcode scanning being a standard on mobile devices one might want to enable Intel(R) Edison to run automated barcode scannings.

Linux Barcode APIs

On Linux there are fully functional open source barcode reading libraries available such as  zxing (Apache 2), or ZBar (LGPL 2.1). Whereas zxing is focused on Java, ZBar has a C implementation and hence doesn't require a Java runtime. In the following description we will use the ZBar API.

USB webcams on Intel® Edison

With recent Yocto images for Intel® Edison, drivers for UVC USB cameras are already included and you may directly use those cameras. For other cameras such as gspca webcams you might need to build the driver first in order to use the camera.

Installing ZBar

We want to be able to use zbar for live videos as well as for static images. For the latter we need the ImageMagick labraries which you can install including all dependencies directly from repo.opkg.net following the instructions via 

# opkg install imagemagick_dev
<span># wget http://sourceforge.net/projects/zbar/files/zbar/0.10/zbar-0.10.tar.bz2
</span><span># cd zbar-0.10
</span><span># ./configure --without-qt --without-gtk --without-xv --without-xshm --with-imagemagick --with-x=no --prefix="/usr" </span>
[...]
<span>which should end after some time with
 </span>[...]

please verify that the detected configuration matches 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 libtool settings don't seem to work 100%. Thus calling "make" ended with an error message. In order to finish the compilation and the install I used following workaround: 

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

In case you don't have "/usr/bin/libtool" installed you can find a package e.g. at repo.opkg.net.

After a successful installation you should find the 2 binaries "/usr/bin/zbarimg" and "/usr/bin/zbarcam". The former is a sample binary reading barcodes from static images. The latter directly from a live video stream via

1# zbarcam --nodisplay

If you have OpenCV installed on Intel(R) Edison you can also combine zbar and OpenCV to run some image processing prior to detection (e.g. OpenCV & ZBar example)

For more such intel IoT resources and tools from Intel, please visit the Intel® Developer Zone

Source: https://software.intel.com/en-us/blogs/2015/11/30/barcodescanner-with-webcam-on-intel-edison