C++ SDK - Installation
About the barKoder SDK for C++ #
Architecture #
Multi-platform support: arm32, arm64, x86, x86_64
Regular libs + OCR-enabled libs (with ONNX runtime)
Both static (.a) and shared (.so) libraries
Key Features #
Supports 40+ barcode formats (QR, Code128, PDF417, UPC/EAN, Aztec, etc.)
ID document scanning capabilities (MRZ, pictures, signatures)
Sync/async decoding with callback support
VIN validation Configurable decoding parameters per format
Building a sample app #
1. Make sure system libraries are installed: #
Debian/Ubuntu
sudo apt update
sudo apt install libcurl4-openssl-dev libjpeg-dev libpng-dev
CentOS / RHEL / AlmaLinux / Rocky Linux
sudo yum install libcurl-devel libjpeg-turbo-devel libpng-devel
Note: Like Debian, libiconv is part of glibc. If you explicitly need GNU libiconv for compatibility, you can build it from source:
sudo yum install libiconv
# (If not in repos, download from https://ftp.gnu.org/pub/gnu/libiconv/ and compile)
Fedora
sudo dnf install libcurl-devel libjpeg-turbo-devel libpng-devel
2. Copy desired architecture shared library file #
The files are placed in the libs folder. You should copy the (.so) files to the system library folder, or into project folder with adjusting LD_LIBRARY_PATH (and LIBRARY_PATH if needed).
Note that building application with using static lib is not officially supported but you may use it on your own risk.
3. Place vlid trial or production key in Config::InitializeWithLicenseKey function #
using namespace NSBarkoder;
ConfigResponse response = Config::InitializeWithLicenseKey("Put valid license key here");
4. Adjust decoder configuration settings #
As desired (activate barcode types, decoding speed, individual barcode type parameters...)
Config *config = response.GetConfig();
Barcode Types & Decode Speed:
// Set decode speed
config->decodingSpeed = NSBarkoder::DecodingSpeed::Rigorous; // Most robust but slower
// Options: Fast, Normal, Slow, Rigorous
// Enable specific decoders
config->SetEnabledDecoders(std::vector<DecoderType>{
DecoderType::Datamatrix,
DecoderType::PDF417,
DecoderType::QR,
DecoderType::Code128,
DecoderType::UpcA,
DecoderType::Ean13
// ... add others as needed
});
// Other configuration examples from sample
config->maximumResultsCount = 100;
config->upcEanDeblur = 1; // Enhanced UPC/EAN decoding
config->code11.checksumType = Code11Config::ChecksumType::Single;
5. Run build script buildSample.sh 5.1 #
Optionally, app can be built without jpg and png libraries, in which case you need to remove them from the build script, and also to remove their definitions from the beginning of Sample.cpp, but in that case only BMP image types can be read.
6. Run the application with specifying image file name as first (and only) argument #
Building with OCR (MRZ) support (in addition to previous steps):
- use libs_ocr source path for libraries with OCR (MRZ) support (only 64 bit platforms are supported)
- copy files from OCR_Resources to executable folder
- make sure to use key with MRZ enabled, otherwise decoder won't return even masked result
Note:
Input image format is limited to 24bit BMP, which is supported by Cimg.h. For more image types it's necessary to implement separate loaders using different system or third party libraries.