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
- Ubuntu System 18.04 or above
- Install Adb tool (Android debugging bridge) on host system
Prerequisites
Install the FastCV SDK
- 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
- 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:
- 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/
To install Hexagon SDK, follow below steps/tools/ $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/
Rename gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf folder to linaro/tools/ $ 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/
Copy 32-bit libfastcv.a from libs provided in the fastcv sdk (fastcv-1-7-1_LinuxEmbedded\lib\32-bit\hard\libfastcv.a) to/examples/common/ /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
$ 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:
- Barcode recognition
- 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:
- 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
Build the application
$ cd Barcode-Reader-App-C610
$ cp barcodeTest//examples/common/. $ 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
Then barcode numbers are displayed on the terminal.
/# chmod +x /data/barcode/barcodeTest
/# cd /data/barcode/
/# ./barcodeTest Images/Digit_1/barcode_1.jpeg
to test with qcs610 camera/# ./barcodeTest camera
Qualcomm QCS610 and Qualcomm Hexagon are products of Qualcomm Technologies, Inc. and/or its subsidiaries.
Contributor(s) Info
Name | Title Company |
---|---|
Rakesh Sankar [email protected] | Sr, System Architect Global Edge Software Ltd |
Ashish Tiwari [email protected] | Architect Global Edge Software Ltd |
Ramsingh G [email protected] | Senior Software Engineer Global Edge Software Ltd |
Priyanka K S [email protected] | Software Engineer Global Edge Software Ltd |