Using The Imaging Source Barcode Library in Qt-based C++
This article demonstrates how to integrate IC Barcode libraries (for AMD 64 or ARM 64 architectures) into a C++ application built with Qt. We’ll walk through the setup process and highlight key features of the implementation.
Prerequisites
Before starting, ensure you have:
- The IC Barcode library installed.
- A C++ development environment.
tiscamera
version 1.1.n (from the Releases page).- Development packages for
tiscamera
. - Qt development packages.
- A compatible video capture device from The Imaging Source.
Build Instructions
Once all prerequisites are met, build the demo with these commands:
mkdir build
cd build
cmake ..
make
Execution
After building, run the application by executing:
cd build
./ICBarcode
Usage Guide
Device Selection
To select a video capture device:
- Open the Device menu and click Select. This launches a dialog to choose your desired camera.
Once selected, you can proceed with barcode scanning:
The example shows two barcode formats (Code128 and DataMatrix) being detected from the same image. The system handles multiple formats and is position invariant.
Device Properties
Adjust device settings via a properties dialog included in the demo:
These dialogs are defined in tcamcamera
subdirectory and can be adapted for custom applications.
Source Code Highlights
Barcode Detection Configuration
Specify which barcode formats to enable with this code snippet:
int formats = 0;
formats |= ICBarcode_Format::IC_BARCODEFORMAT_CODE_128;
formats |= ICBarcode_Format::IC_BARCODEFORMAT_EAN_13; // and other desired formats...
ICBarcode_SetBarcodeFormats(_callback_user_data.pIC_BarcodeScanner, formats);
Reducing the number of formats improves detection speed.
Multithreading Support
The implementation separates barcode processing (using GStreamer) from the Qt GUI thread. Results are communicated via event handlers defined in mainwindow.h
to ensure smooth performance.
Graphic Overlay
Customize video feeds with graphical overlays using XML descriptions and the GStreamer rsvgoverlay element, enabling visual enhancements like bounding boxes around detected barcodes.
Support
For questions or issues, please reach out to The Imaging Source team.
Last Updated: 2025-09-05 00:07:23