Barcode Reader

Barcode Reader using Basler Dart USB camera and Raspberry Pi 2 (also for Windows)


Barcode Reader (mbreit 2016-09-23)

This project uses the zxing ("Zebra Crossing") library to automatically identify and decode various 1D and 2D barcodes.

    The latest C++ port can be found here:

    The original sample program which inspired this can be found here:

It uses a Basler dart USB camera and Basler Pylon 5.0.5 drivers for image acquisition and enhancement (to offload some host processing).

    Camera details can be found here:

    Driver details:

It also uses OpenCV 2.4.10 for image Display and some processing.

Running the Windows_Project :

  1. All you should have to do is build and run the program in visual studio.

  2. The required headers and libraries for OpenCV and zxing are pre-built and included in the /lib and /include folders.

  3. The libraries are statically linked, so you should just have one .exe file to run.

Running the Linux-x86 Project:

  1. This is similar to the windows project. It contains headers and prebuilt OpenCV/zxing libraries for Linux Mint 17.2 (ubunutu).

  2. The makefile will look at /include and /lib

  3. If that doesn't work, you need to build the zxing and opencv libraries for your machine. **

Running the Linux-RPi Project:

  1. This requires you to build the libraries (we've included a prebuilt zxing library you can try though).

  2. The makefile expects to see the zxing library (libzxing.a) in /lib and the OpenCV libraries in /usr/lib.

  3. To install the zxing library:

    1. unpack

    2. Go to this folder, create 'cpp/build' folder

    3. run 'cmake -G "Unix Makefiles" ..'

    4. Go to cpp/build and run 'make'

    5. Grab a coffee (on RPI est. 20 minutes to build)

    6. Find libzxing.a in cpp/build. Copy it to PylonSample_Barcode/lib

  1. To install the OpenCV libraries:

    1. Shortcut: See the attached application note to install prebuilt rpi libraries (building on device can take hours!).

** Building and adding libraries for the Linux-x86 Project:

(There are other ways to do this of course, this is just one example :))

To install the zxing library:

    1. unpack

    2. Go to this folder, create 'cpp/build' folder

    3. run 'cmake -G "Unix Makefiles" ..'

    4. Go to cpp/build and run 'make'

    5. Find libzxing.a in cpp/build. Copy it to PylonSample_Barcode/lib

To install the OpenCV libraries:

    1. unpack

    2. go to this folder and create a folder named 'release'

    3. go to the release folder and run 'cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..'

    4. run 'make'

    5. run 'sudo make install'

    6. Copy,, from XXXXX to PylonSample_Barcode/lib

       (or modify the makefile to point to /usr/lib)

    7. Copy the appropriate headers to /include, or modify the makefile to point to the opencv installation


License Info:



GitHub Repository


pushed d599342ee75b45204409cf11c77626632078d559
Added note that if display is needed on Linux, OpenCV can be used.
2020-01-22 20:11:00 UTC
pushed 0274acf2bc11358efcfc3e3ac018ffaa09f5c193
Merge branch 'master' of
2020-01-22 20:08:03 UTC
pushed 0d8b5637c77a6b826346d6fc7c4d8f209b87e09b
Completely re-written to remove all need for OpenCV.
2020-01-22 20:03:47 UTC
pushed 54b9438997f195ebefba4a6468e6f4ab3323150a
Completely re-written to remove all processing needs for OpenCV. (Linux will still need it for display)
2020-01-22 20:03:47 UTC
pushed ac83ded25a9d0b5f6a50963eccd3a6c27c3f39b5
added notice file.
2017-08-30 20:45:11 UTC
pushed 6b39ee95d16a4f64e4b0d8399067ffb30ea654e2
License change to Apache 2.0
2017-08-30 20:40:42 UTC
pushed cc05cd1e8a046a34e1bb576aeed91085edc3bf45
added new git ignore file.
2017-08-29 19:32:03 UTC
pushed 4f9518d73a3f74f7207b4399306b9a0f93df014f
adding linux x86 and windows x64 libraries
2017-08-29 19:28:37 UTC
pushed 8a01c62d7406f190c411d46569ba6297245d1cda
First code commit
2017-08-29 19:20:32 UTC
Matthew B
pushed 96f3c5288241cf5d49c7a2d2a6ea068c5a160832
Initial commit
2017-08-29 17:23:26 UTC
Title Description Format
Source code Sample projects for Windows, Linux, and RPi zip
Screenshot Windows Screenshot jpg
Screenshot 2 Linux screenshot jpg
Screenshot 3 Raspberry Pi screenshot JPG
Updated Source Code Cleaned up a lot of code. See forum for details cpp
Task Owner Creation Date
Add safety code to handle camera disconnects, errors, etc.
Add support for saving images
Add support for logging data
Add support for Adafruit 2.5" TFT touchscreen

Project State

Public Project Participation wanted


Software Licence: Apache 2.0
Hardware Licence: Project has no hardware

Project Tags




Does this project pique your interest?

Login or register to join or follow this project.

mattb report abuse

Finally added to a github repo!

Back to top

Ready to join the project?

You'd like to participate ... Show more