Building Python Barcode Extension with DBR 5.2 for Linux

According to the statistics of Stack Overflow traffic, Python is the fastest-growing major programming language in high-income countries. Python seems to be promising in the future. I have noticed that many of the developers who would like to use Dynamsoft Barcode Reader SDK for Linux are more interested in Python rather than C/C++ or Java. In this post, I will illustrate how to build the Python barcode extension with DBR 5.2.

Writing Python Barcode Extension in C/C++

Dynamsoft Barcode Reader 5.2 for Linux provides C/C++ APIs, which means you need to create a Python wrapper yourself.

Setting Up Environment

The Ubuntu subsystem is my first choice for developing Linux app on Windows 10.

Download Numpy 1.11.2.

Extract and install Numpy

Find the path of ndarraytypes.h:

Create and add the header file directory:

Extract dbr_linux_5.2.tar.gz:

Create a symlink for

The bridging C/C++ code

Include header files:

Define methods and initialize Python module:

Initialize DBR license:

Pass a file name and read barcodes:

Give an image buffer and read barcodes:

Convert results to Python Object:

Build and install the Python barcode extension:

A command line barcode app

Read barcodes from a picture file:

Run the app:


Source Code

Originally published at on September 18, 2017.

Manager of Dynamsoft Open Source Projects | Tech Lover