Click here to Skip to main content
15,881,882 members
Articles / Internet of Things
Article

Barcodescanner with webcam on Intel® Edison

16 Dec 2015CPOL2 min read 21.7K   1  
With barcode scanning being a standard on mobile devices one might want to enable Intel(R) Edison to run automated barcode scannings.

This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers.

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://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" 
[...]

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)

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
You may know us for our processors. But we do so much more. Intel invents at the boundaries of technology to make amazing experiences possible for business and society, and for every person on Earth.

Harnessing the capability of the cloud, the ubiquity of the Internet of Things, the latest advances in memory and programmable solutions, and the promise of always-on 5G connectivity, Intel is disrupting industries and solving global challenges. Leading on policy, diversity, inclusion, education and sustainability, we create value for our stockholders, customers and society.
This is a Organisation

42 members

Comments and Discussions

 
-- There are no messages in this forum --