Version 7.2
The repository aims to help developers build Python barcode apps with Dynamsoft Barcode Reader in Windows, Linux, macOS, and Raspberry Pi.
Get the trial license.
Python 2/3
-
Linear Barcodes (1D)
- Code 39 (including Code 39 Extended)
- Code 93
- Code 128
- Codabar
- Interleaved 2 of 5
- EAN-8
- EAN-13
- UPC-A
- UPC-E
- Industrial 2 of 5
-
2D Barcodes:
- QR Code (including Micro QR Code)
- Data Matrix
- PDF417 (including Micro PDF417)
- Aztec Code
- MaxiCode (mode 2-5)
-
Patch Code
-
GS1 DataBar (Omnidirectional, Truncated, Stacked, Stacked Omnidirectional, Limited, Expanded, Expanded Stacked)
-
GS1 Composite Code
-
OpenCV
pip install opencv-python python3 -m pip install opencv-python
For Raspberry Pi
sudo apt-get install libopencv-dev python-opencv
-
NumPy
pip install numpy python3 -m pip install numpy
Set Visual Studio in cmd.exe. For example, Visual Studio 2015:
SET VS90COMNTOOLS=%VS140COMNTOOLS%
Edit setup.py
. Replace the dbr_lib_dir and dbr_dll with yours:
dbr_lib_dir = r'e:\Program Files (x86)\Dynamsoft\Barcode Reader 7.2\Components\C_C++\Lib'
dbr_dll = r'e:\Program Files (x86)\Dynamsoft\Barcode Reader 7.2\Components\C_C++\Redist\x64'
Build and install the Python extension:
cd src
python setup.py build install
python3 setup.py build install
Copy libDynamsoftBarcodeReader.so/libDynamsoftBarcodeReader.dylib to /usr/lib
. If you don't have access to /usr/lib
, try to copy the library to /usr/local/lib
and set the LD_LIBRARY_PATH as follows:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
Build and install the Python extension:
cd src
sudo python setup.py build install
sudo python3 setup.py build install
-
examples/video
python rtsp.py
-
examples/camera
python camera-decodevideo.py
-
examples/command-line
python test.py
-
initLicense(license-key)
-
decodeFile(filename, barcodeTypes)
barcodeTypes = dbr.BF_ONED | dbr.BF_PDF417 | dbr.BF_QR_CODE | dbr.BF_DATAMATRIX | dbr.BF_AZTEC
Barcode Format Values ALL dbr.BF_ALL 1D dbr.BF_ONED PDF417 dbr.BF_PDF417 QR Code dbr.BF_QR_CODE DataMatrix dbr.BF_DATAMATRIX Aztec Code dbr.BF_AZTEC -
decodeBuffer(frame-by-opencv-capture, barcodeTypes)
-
startVideoMode(max_buffer, max_results, video_width, video_height, image_format, barcodeTypes, callback)
-
stopVideoMode()
-
appendVideoFrame(frame-by-opencv-capture)
-
initLicenseFromLicenseContent(license-key, license-content)
-
outputLicenseToString()
-
initLicenseFromServer(license-key, license-server)
-
setFurtherModes(mode, [values])
-
setParameters(json-string)
https://www.dynamsoft.com/Products/Barcode-Reader-Resources.aspx#documentation
- How to Define Python Object Members in C Code
- Python Barcode Decoding on Non-Python Created Thread
- Things to Do with DBR 6.0 and Python Barcode Extension
- How to Port C/C++ Barcode Extension to Python 3
- Building Python Barcode Extension with DBR 5.0 on Windows
- Building Python Barcode Extension with DBR 5.2 for Linux