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.
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 https://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
please verify that the detected configuration matches your expectations:
=> the GTK+ widget will *NOT* be built
=> 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 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