This repo using pyzbar library with opencv to read both QR and barcode. However, if you only want to read QRCode, you can simply use the built-in function in openCV (QRCodeDetector).
There are 2 modes in the project:
- stream: real time detect via video
- image: detect on an input image
Detected code will be displayed with a message (text) over the bounding box.
- Ubuntu 20.04 (runnable on Raspberry Pi)
- Python 3.7
- OpenCV
- Pyzbar
IMPORTANT: Remember to install libzbar0 first, otherwise it will get error when running
sudo apt-get install libzbar0
Arguments parser
'--mode', '-m',
choices=['stream', 'image'],
type=str,
description='choose detect mode: on streaming video or on single image')
'--img', '-i':
type=str
description='image path'
'--rate', '-r':
description:'Call read QR/Bar code after this number of frames'
default: 1
Install all libraries
Run the program
With image
python run.py -m image -i test.png
Stream video
python run.py -m stream

