This sample demonstrates how to use the The Imaging Source Barcode Library from IC Barcode for AMD 64 or IC Barcode for ARM 64 in a Qt based C++ program.
- IC Barcode library (see above)
- C++
- tiscamera 1.1.n from Releases
- tiscamera dev packages from Releases
- Qt dev packages
- A The Imaging Source video capture device from here
After all above mentioned packages have been installed, the demo is built with
mkdir build
cd build
cmake ..
make
cd build
./ICBarcode
Click on the "Device" menu an select "Select". That opens the device selection dialog:
After a device is selected, it is started and barcodes can be scanned:
On the image is a Code128 and a Datamatrix Code. Both can be scanned on the same image. They are also position invariant.
This sample contains a properties dialog for setting all properties:
The device selection and the device properties dialogs are in the tcamcamera
subdirectory. This can be used in your own software.
The barcode to be detected can be specified as follows:
int formats = 0;
formats |= ICBarcode_Format::IC_BARCODEFORMAT_CODE_128;
formats |= ICBarcode_Format::IC_BARCODEFORMAT_CODE_93;
formats |= ICBarcode_Format::IC_BARCODEFORMAT_EAN_13;
formats |= ICBarcode_Format::IC_BARCODEFORMAT_EAN_8;
formats |= ICBarcode_Format::IC_BARCODEFORMAT_UPC_A;
formats |= ICBarcode_Format::IC_BARCODEFORMAT_QR_CODE;
formats |= ICBarcode_Format::IC_BARCODEFORMAT_DATA_MATRIX;
//formats |= ICBarcode_Format::IC_BARCODEFORMAT_INTERLEAVED_2_OF_5;
//formats |= ICBarcode_Format::IC_BARCODEFORMAT_CODE_39;
ICBarcode_SetBarcodeFormats(_callback_user_data.pIC_BarcodeScanner, formats);
The shorter the list, the faster is the detection.
Gstreamer runs in a different thread, than the QT GUI. Therefore, the barcode results will be passed by an event structure to the GUI mainthread. For this, the event handler and classes are defined in mainwindow.h
The graphical display of a red frame around the overlay is done with the GSteamer rsvgoverlay element. It receives an XML string which contains the graphic description.
For questions please contact us at https://www.theimagingsource.com/en-us/company/contact/.