Everyone is already accustomed 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 the appropriate software.
Barcode API for Linux
There are excellent open source Linux libraries for working with barcodes. Among them, for example,
zxing (Apache 2 license), and
ZBar (LGPL 2.1 license.). When choosing a library, you should take into account that zxing is originally written in Java, and ZBar has a C-implementation that allows you to do without the Java runtime. We will use ZBar.
Intel Edison and USB webcams
The latest Yocto images for Intel Edison include drivers for
UVC USB cameras . That is, it is enough to connect a compatible camera to the device and it will be possible to work with it. In order to use other types of cameras, such as those with which the
gspca module
supports , you may need to build a suitable driver yourself.
')
Zbar
ZBar we need to work with real-time video and still images. For the latter, you will need
ImageMagick libraries, which, along with all dependencies, can be installed from
repo.opkg.net by following these
instructions . Namely, it is done this way:
# 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
libtool
options are not fully functional. Therefore, the
make
call ends with an error message. In order to complete the compilation and install what you need, you had to look for a workaround:
# rm libtool # ln -s /usr/bin/libtool libtool # make # make install
If you do not have
usr/bin/libtool
installed, the required package can be found on
repo.opkg.net .
After successful installation, it will be possible to detect a pair of binary files located at the addresses
/usr/bin/zbarimg
and
/usr/bin/zbarcam
. Zbarimg recognizes barcodes by processing graphic files. Zbarcam is looking for barcodes in video streams:
# zbarcam --nodisplay
Results
As you can see, Intel Edison is easy to equip with everything you need to work with bar codes. And if you add OpenCV here, you can
combine it with ZBar in order to prepare images before recognition.