Real time Barcode and QR Code scanner using the camera. It's built on top of Kivy and pyzbar.
Simply import and instanciate ZBarCam in your kvlang file and access its symbols property.
#:import ZBarCam kivy.garden.zbarcam.ZBarCam
#:import ZBarSymbol pyzbar.pyzbar.ZBarSymbol
BoxLayout:
orientation: 'vertical'
ZBarCam:
id: zbarcam
# optional, by default checks all types
code_types: ZBarSymbol.QRCODE, ZBarSymbol.EAN13
Label:
size_hint: None, None
size: self.texture_size[0], 50
text: ', '.join([str(symbol.data) for symbol in zbarcam.symbols])Install system requirements (Ubuntu 18.04):
sudo apt install libzbar-devInstall garden requirements:
garden install --upgrade xcameraInstall zbarcam:
Via garden:
garden install --upgrade zbarcamWhen installed with this method, the import command would be:
from kivy.garden.zbarcam import ZBarCamVia pip:
pip install --upgrade https://github.com/kivy-garden/garden.zbarcam/archive/develop.zipWhen installed with this method, the import command would be:
from zbarcam import ZBarCamYou may also need to compile/install OpenCV manually, see OpenCV.md.
Build for Android via buildozer, see buildozer.spec.
To play with the project, install system dependencies and Python requirements using the Makefile.
makeThen verify everything is OK by running tests.
make test
make uitestMissing the xcamera dependency, install it with:
garden install xcameraMore likely an import issue in your .kv file.
Try to from zbarcam import ZBarCam in your main.py to see the exact error.
It's common to forget Pillow in buildozer.spec requirements section.
See OpenCV.md.
I borrowed a lot of code from tito/android-zbar-qrcode.

