跳转到主要内容

利用在Intel Edison上的网络摄影机的条形码扫描仪

editor 提交于


Linux条形码APIs

在 Linux 上有读取链接库如zxing可用的全功能性开放源码函式库(Apache 2),或是ZBar (LGPL 2.1)。而zxing着重于Java程序,ZBar能应用在C语言,因此不需要透过Java来执行。在下列描述中,我们将使用ZBar API。

与INTEL® EDISON搭配的USB网络摄影机

关于最近与Intel® Edison搭配的Yocto映射档, 已包含UVC USB cameras驱动程序,所以您可以直接使用这些网络摄影机。而其他如gspca的网络摄影机,您可能在使用前需要先建立驱动程序。

安装ZBar

若我们想要利用zbar做实时视讯与静态影像功能。若想要使用静态影像功能,需要从repo.opkg.net依照其安装步骤来安装ImageMagick链接库。

# 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

遗憾的是libtool设定无法完全100%执行。为了能完成编译与安装流程,我会利用以下的其他替代方案:

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

若是您没有安装"/usr/bin/libtool",可以从repo.opkg.net寻找相关套件。

在成功安装完成后,您应该会在"/usr/bin/zbarimg"与"/usr/bin/zbarcam"相关文件找到2进制。而"/usr/bin/zbarimg"为读取静态影像的二进制条形码范例。/usr/bin/zbarcam则是透过

# zbarcam --nodisplay

来直接读取实时影像。

假设您已经在Intel® Edison安装了OpenCV,可结合zbar与OpenCV在检测前来执行图像处理(OpenCV与ZBar為范例)。

文章来源:英特尔来发人员专区