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
$ cp -r gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/ /tools/
$chmod 777 qualcomm_hexagon_sdk_3_5_2_eval.bin
$./qualcomm_hexagon_sdk_3_5_2_eval.bin
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
$ cp -r gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/ /tools/
$ mv gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf linaro
$ cp fastcv-1-7-1_LinuxEmbedded/samples/fastcvSimpleTest/ /examples/common/
$ cp fastcv-1-7-1_LinuxEmbedded\lib\32-bit\hard\libfastcv.a /examples/common/fastcvSimpleTest/lib/
$ cd < Hexagon SDK root directory>
$ source setup_sdk_env.source
$ cd examples/common/fastcvSimpleTest
Execute command below command
$ make tree V=UbuntuARM_Release
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 /
$ git clone https://github.com/globaledgesoft/Barcode-Reader-App-C610
$ 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/
$ adb shell
/# 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.
Sign up for the Developer Newsletter.
Get software and hardware tool resources to help optimize your development delivered to your inbox weekly.
