Raspberry Pi 3B +, OpenCV, USB camera Chinese dimensional code recognition

Recently doing a project with a raspberry pie and USB camera with a Chinese two-dimensional code identification information and information oled screen, originally thought not difficult, did not expect to encounter a lot of trouble, and now the project done, come back to re-set it

The main reference of the blog are:

Dimensional code recognition section: https://blog.csdn.net/sinat_35162460/article/details/90245448   , https://blog.csdn.net/zx66zx/article/details/82785334

Scan information in oled screen display: https://blog.csdn.net/wangzhenyang2/article/details/80299625

 

We consider the two-dimensional code identification using zbar, pyzbar and OpenCV, can run in environments python2.7 and python3.5

zbar is used to read the bar code of the open source packages from a variety of sources, not described in detail here

Set up a raspberry come in the environment

First, install zbar

A method, use the command line: sudo apt-get install python-zbar

The second method used to install zbar, source, this method can identify Chinese

1, using the wget command to specify the URL to download from zbar Source:

wget http://downloads.sourceforge.net/project/zbar/zbar/0.10/zbar-0.10.tar.gz

2, the decompression zbar source file to extract the files in zbar-0.10 pi directory folders

tar -zvxf zbar-0.10.tar.gz

3, the compiler needs to compile the installation, and install the python-gtk libqt4-dev

sudo apt-get install python-gtk2-dev

sudo apt-get install libqt4-dev

4, modify zbar of Chinese support

cd into the zbar-0.10 / zbar / qrcode directory, use the nano editor to open the file qrdectxt.c

CD-zbar 0.10

cD zbar

cd qrcode

sudo nano qrdectxt.c

Find the default encoding function, the ISO8859-1 into UTF-8

Found default encoding defined list, modify decoding the encoded sequence is:

enc_list[0]=utf8_cd 

5, into the zbar-0.10 folder, run the following command to configure, generate makefile

./configure --without-imagemagick -disable-video -without-qt -without-gtk -without-x

6, the compiler makefile

make

7, make install

sudo make install

After installation into the environment python import zbar, I found it impossible to import in python

Solution: After compiling the installation is complete, three .so files in the usr / local / lib folder and zbar related move to the next / lib / arm-linux-gnueabihf, so python library error will not call zbar

Second, the installation pyzbar

Using the command line to install pyzbar

sudo pip install pyzbar

Third, install OpenCV

Reference https://blog.csdn.net/sinat_35162460/article/details/84245240

 

Then use the two-dimensional code python identification routines, you can correctly identify the two-dimensional code with the Chinese

 

Guess you like

Origin www.cnblogs.com/vzyk/p/11979315.html