tiscamera IC Barcode Demo

Published on June 28, 2023 by TIS Marketing.

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.

Prerequisites

Screen capture: IC Barcode

Build

After all above mentioned packages have been installed, the demo is built with

mkdir build
cd build 
cmake ..
make

Execution

cd build 
./ICBarcode

Usage

Device Selection

Click on the Device menu and click Select, opening the device selection dialog:

Device Selection

After a device has been selected, you can now begin scanning barcodes:

Scanned Barcodes On the above image, one can see a Code128 and Datamatrix code. Both can be scanned from the same image. The codes are also position invariant.

Device Properties

This sample contains a properties dialog for setting all properties:

Scanned Barcodes

The device selection and the device properties dialogs are in the tcamcamera subdirectory. This can be used in your own software.

Source Code

Choosing Barcodes to Detect

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 the detection.

Multithreading and Events

Gstreamer runs in a different thread, than the QT GUI. Therefore, the barcode results are passed by an event structure to the GUI mainthread. For this, the event handler and classes are defined in mainwindow.h

Graphic Overlay

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.

Questions and Contact

For questions, please contact us.