This repository contains examples demonstrating how to utilize the Dynamsoft Barcode Reader SDK to build barcode and QR code detection applications with C++ and CMake on Windows, Linux, macOS, and Raspberry Pi.
-
Obtain a 30-day free trial license for Dynamsoft Barcode Reader. Update the following code in
main.cxx
:DBR_InitLicense(license, errorMsgBuffer, 512);
-
OpenCV Installation
-
Download OpenCV
-
Configure the environment variable
OpenCV_DIR
to the path of the OpenCV installation directory. -
Add the following lines to the
CMakeLists.txt
file:# Find OpenCV, you may need to set OpenCV_DIR variable # to the absolute path to the directory containing OpenCVConfig.cmake file # via the command line or GUI find_package(OpenCV REQUIRED)
-
- Windows x64
- Linux x64/ARM64/ARM32
- macOS x64 (Intel/Apple Silicon)
Windows
-
Create a build folder:
mkdir build cd build
-
Configure and build the project:
# x86 cmake -DCMAKE_GENERATOR_PLATFORM=x86 .. # x64 cmake -DCMAKE_GENERATOR_PLATFORM=x64 .. cmake --build . --config release
For
MinGW
:cmake -G "MinGW Makefiles" ..
Linux and Raspberry Pi OS
-
Install CMake:
sudo apt-get install cmake
-
Create a build folder:
mkdir build cd build
-
Configure and build the project:
cmake .. cmake --build . --config release
macOS
-
Install CMake:
brew install cmake
-
Create a build folder:
mkdir build cd build
-
Configure and build the project:
cmake .. cmake --build . --config release
-
./main [image-file] [optional: license-file] [optional: template-file]
-
./main
-
./main
-
Raspberry Pi with OLED Display
./main