Back to All
Project

Smart Barcode Reader on QCS610 SoC

This project is designed to implement the EAN-13 barcode decoding application on TurboX C610 Open kit powered by the Qualcomm® QCS610 SoC.

Objective

The main objective of this application is to capture the barcode images from the TurboX C610 dev kit and then decode the EAN-13 barcode information from the captured barcode.

Equipment Required / Parts List / Tools

Equipment Link
Thundercomm TurboX C610 development board https://www.thundercomm.com/app_en/product/1593776185472315?index=1&categoryId=categorynull
USB Cables For serial console interface, ADB and fastboot commands. USB3.0 Type C port for connecting to the board and flashing images.

Source Code / Source Examples / Application Executable

Description Link
Source Code:EAN-13 Barcode detection and decoding using FastCV https://github.com/globaledgesoft/Barcode-Reader-App-C610

Additional resources

Resource Title Link or File name (and provide File)
Thundercomm TurboX C610 Platform Linux User Guide Please refer to technical documents section on the product page:
https://www.thundercomm.com/app_en/product/1593776185472315?index=1&categoryId=categorynull

About the Project
In this project, the app is designed to perform barcode region detection and recognition of the EAN-13 type barcode in the given image.

The application source tree on the host system is as seen below:barcodeTest/
 inc/
  - fastcv.h
  - barcode_decoder.h
  stb/
   - stb_image.h
   - stb_image_write.h
  opencv2/
   - Contain opencv header file
 lib/
  - contain fastcv and opencv libraries
 src/
  - barcode_decoding.cpp
  - main.cpp
 sampleImage/
 Contain barcode images for testing
 Makefile
 UbuntuARM.min

Dependencies

  1. Ubuntu System 18.04 or above
  2. Install Adb tool (Android debugging bridge) on host system

Prerequisites
Install the FastCV SDK

  1. Download FastCV SDK from url https://developer.qualcomm.com/software/fast-cv-sdk/tools and select particular version named v1.7.1 for Linux Embedded
  2. For FastCV installation and compilation, follow the below steps,
$ chmod 777 fastcv-installer-linuxembedded-1-7-1.bin
$ ./fastcv-installer-linuxembedded-1-7-1.bin

To build application in fastcv:

  1. Download Qualcomm® Hexagon™ DSP SDK from Qualcomm Developer Network https://developer.qualcomm.com/software/hexagon-dsp-sdk
    Extract the tar file
$ tar xvf gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar
copy folder gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf to /tools/ folder.
$ cp -r gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/ /tools/ 
 
To install Hexagon SDK, follow below steps
$chmod 777 qualcomm_hexagon_sdk_3_5_2_eval.bin
$./qualcomm_hexagon_sdk_3_5_2_eval.bin
  • Download gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar using given url
    https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabihf/
    Extract the tar file
  • $ tar xvf gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar
    
    copy folder gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf to /tools/ folder.
    $ cp -r gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/ /tools/ 
     
    Rename gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf folder to linaro
    $ mv gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf linaro
    
  • Keep the application folder ‘fastcvSimpleTest’ in /examples/common/ folder
  • $ cp fastcv-1-7-1_LinuxEmbedded/samples/fastcvSimpleTest/ /examples/common/ 
     
    Copy 32-bit libfastcv.a from libs provided in the fastcv sdk (fastcv-1-7-1_LinuxEmbeddedlib32-bithardlibfastcv.a) to /examples/common/fastcvSimpleTest/lib/ Folder.
    $ cp fastcv-1-7-1_LinuxEmbedded\lib\32-bit\hard\libfastcv.a  /examples/common/fastcvSimpleTest/lib/ 
     
  • Open a new terminal from the root directory of the Hexagon SDK and run below command
  • $ cd < Hexagon SDK root directory>
    $ source setup_sdk_env.source
    
  • Change the directory to fastcvSimpleTest
  • $ cd examples/common/fastcvSimpleTest
    Execute command below command
    $ make tree V=UbuntuARM_Release
    
  • A folder with the name "UbuntuARM_Release" should get generated in the fastcvSimpleTest folder. It will contain the application’s binary file ‘fastcvSimpleTest’.

  • Introduction to Barcode:

    Barcode is an image having a shape like a square or rectangle that consists of a sequence of parallel black lines and white spaces of various widths. Barcodes are placed on products for quick identification. 1D barcodes are used to store text information, like product size, type and color.

    In this project we are decoding EAN (European Article Number) barcodes of type 1-D.

    EAN is one of the standardized barcodes which is marked on most commercial products which are currently available at the stores. EAN barcodes only represent the digits 0–9, whereas some other barcodes can represent additional characters along with digits

    Following figure represents EAN-13 data composition.

    (1) Country code
    Code that indicates the country 's name.

    (2) Manufacturer code
    It tells the original seller's name. Manufacturer code is applied for registration at the code center of each country in order to obtain it. EAN code can be used only after the manufacturer code is obtained.

    (3) Product item code
    Identifies the product. Different products from the same manufacturer have different product item codes.

    (4) Check digit
    It is used to verify whether a barcode has been scanned correctly or not.

    EAN Decoding involves 2 steps:

    1. Barcode recognition
    2. Barcode decode

     

    Barcode recognition:
     Input image is converted to a grayscale image. On the resulting image, apply morphological operations and then apply contours to get the region of interest of barcode.

    Barcode decode:
    Digits in the barcode are split into three groups such that: First digit, the first group of 6, the last group of 6.

    Leaving the first digit, each digit of barcode is represented by 4 bars, such that white and black are alternate for the first group of 6, black and white are alternate for the last group of 6.

    Each group of 4 bars has the bar width as 7, whereas each bar in the group of 4 can be any value from 1 to 4. Binary values of this 7 bit value are compared with ‘L’ ‘G’ ‘R’ Table and barcode numbers are extracted.

    Steps to run the application:
    To run application on the c610 board:

    1. Remount the root directory writable:
    $ adb root
    $ adb remount
    $ adb shell mount -o remount,rw /
    
  • Push the fastcvSimpleTest binary file and input image to the target:
  • $ git clone https://github.com/globaledgesoft/Barcode-Reader-App-C610
    $ cd Barcode-Reader-App-C610
    $ cp barcodeTest/ /examples/common/. 
     
    Build the application
    $ cd  
    $ source setup_sdk_env.source 
    $ cd examples/common/barcodeTest/ 
    $ make tree V=UbuntuARM_Release 
    $ adb push UbuntuARM_Release\ship\barcodeTest /data/barcode 
    $ adb push sampleImage/ /data/barcode/ 
     
  • Change bin permissions and execute the application executable:
  • $ adb shell
    /# chmod +x /data/barcode/barcodeTest
    /# cd /data/barcode/
    /# ./barcodeTest Images/Digit_1/barcode_1.jpeg
    
    Then barcode numbers are displayed on the terminal.

    to test with qcs610 camera

    /# ./barcodeTest camera
    


    Qualcomm QCS610 and Qualcomm Hexagon are products of Qualcomm Technologies, Inc. and/or its subsidiaries.

    Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries ("Qualcomm"). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.

    Project Authors
    GlobalEdge Software
    Rakesh SankarSr, System Architect
    Ashish TiwariArchitect
    Ramsingh GSenior Software Engineer
    Priyanka K SSoftware Engineer

    Sign up for the Developer Newsletter.

    Get software and hardware tool resources to help optimize your development delivered to your inbox weekly.

    Qualcomm relentlessly innovates to deliver intelligent computing everywhere, helping the world tackle some of its most important challenges. Our leading-edge AI, high performance, low-power computing, and unrivaled connectivity deliver proven solutions that transform major industries. At Qualcomm, we are engineering human progress.

    Stay connected

    Get the latest Qualcomm and industry information delivered to your inbox.

    Subscribe
    Manage your subscription

    © Qualcomm Technologies, Inc. and/or its affiliated companies.

    Snapdragon and Qualcomm branded products are products of Qualcomm Technologies, Inc. and/or its subsidiaries. Qualcomm patented technologies are licensed by Qualcomm Incorporated.

    Note: Certain services and materials may require you to accept additional terms and conditions before accessing or using those items.

    References to "Qualcomm" may mean Qualcomm Incorporated, or subsidiaries or business units within the Qualcomm corporate structure, as applicable.

    Qualcomm Incorporated includes our licensing business, QTL, and the vast majority of our patent portfolio. Qualcomm Technologies, Inc., a subsidiary of Qualcomm Incorporated, operates, along with its subsidiaries, substantially all of our engineering, research and development functions, and substantially all of our products and services businesses, including our QCT semiconductor business.

    Materials that are as of a specific date, including but not limited to press releases, presentations, blog posts and webcasts, may have been superseded by subsequent events or disclosures.

    Nothing in these materials is an offer to sell or license any of the services or materials referenced herein.