Get access to the new Intel® IoT Developer Kit, a complete hardware and software solution that allows developers to create exciting new solutions with the Intel® Galileo and Intel® Edison boards. Visit the Intel® Developer Zone for IoT.
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
# wget http:# cd zbar-0.10
# ./configure --without-qt --without-gtk --without-xv --without-xshm --with-imagemagick --with-x=no --prefix="/usr"
[...]
which should end after some time with
[...]
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
# 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)