Qualcomm Robotics RB5/RB6 - FastCV Installation and Sample Application

From RidgeRun Developer Connection
< Qualcomm Robotics RB5‎ | Image Processing Software‎ | Fast CV
Revision as of 17:36, 31 July 2023 by Lmerayo (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search



Index





For an increasing demand for high quality computer vision and augmented reality experiences, the Qualcomm Computer Vision SDK or FastCV is a library that contains numerous of the most widely used vision processing functions for real-time image processing and augmented reality capabilities. Developers can take advantage of the library to develop computer vision applications with functionalities such as face detection, tracking and recognition, as well as, gesture and text recognition and run them on the Qualcomm Robotics RB5/RB6. In the next steps you will learn how to install the SDK on a Linux system and run one sample application in your Qualcomm Robotics RB5/RB6 platform.

Note
All the following steps were made on a computer with x86 64-bit architecture and Ubuntu 20.04.
Note
At some point in this steps you will be required to login with your Qualcomm credentials, if you don't already have an account click the following link to create one. Note that Qualcomm will take some time to validate your account.



Downloading and installing FastCV

Downloading FastCV Installer

1. Click on the following link and choose the Qualcomm Computer Vision SDK v1.7.1 for Linux Embedded – Linux Installer option to download the Linux installer binary(.bin) of the SDK for Linux Embedded FastCV_Linux_Installer.

Note
The binary file name is fastcv-installer-linuxembedded-1-7-1.bin. Notice the number 1.7.1 is the version of the SDK that was available at the time of making this procedure.

Installing FastCV

1. Give the Installer binary execution permissions:

chmod 777 fastcv-installer-linuxembedded-1-7-1.bin

2. Execute the Installer:

Note
Once executed a window will open to continue with the installation steps
./fastcv-installer-linuxembedded-1-7-1.bin


Error creating thumbnail: Unable to save thumbnail to destination
Figure 1: Installation Introduction Window


3. On the window like the one in Figure 1, click Next.
4. On the next window you will be requested to choose a destination folder where the SDK will be installed, you can you the destination you prefer, then click Next.
5. On the next window you will be requested to accept the terms of the license agreement, click on I accept the terms of the License Agreement, then click Next.
6. On the next window you will be shown the pre-installation summary, once you verified the install folder and disk space, click Install the installation will begin.
7. Once the Installation is completed, a window titled Install Complete will appear, you can click Done to close the installer.

Installing the building tools

To build a FastCV application the Hexagon DSP SDK and the linaro toolchain will be needed.

Downloading the Hexagon DSP SDK[1]

1. Follow the instructions from the following link to download and install the Hexagon DSP SDK Hexagon DSP SDK Installation. Once installed you can continue with the next steps.

Downloading Linaro toolchain

1. Click on the following package from this link to download it:

gcc-linaro-4.9-2014.11-x86_64_aarch64-linux-gnu.tar.xz	26-Feb-2018 20:48	129.8M	open
Note
A tar package will be downloaded with a name similar to the following gcc-linaro-4.9-2014.11-x86_64_aarch64-linux-gnu.tar.xz

2. Decompress the tar package:

tar -xvf gcc-linaro-4.9-2014.11-x86_64_aarch64-linux-gnu.tar.xz

A folder will be created:

gcc-linaro-4.9-2014.11-x86_64_aarch64-linux-gnu

3. Move the decompressed folder to the <HEXAGON_SDK_ROOT_DIR>/tools directory. Where the <HEXAGON_SDK_ROOT_DIR> is the directory you specified in the json file of the installation of the Hexagon SDK, in our case its /home/user/work/rnd/qualcomm_robotics_rb5/hexagon_sdk/<version> where <version> is the version of the SDK, in this case its 5.2.0.0. Finally rename the folder to linaro64:

mv gcc-linaro-4.9-2014.11-x86_64_aarch64-linux-gnu <HEXAGON_SDK_ROOT_DIR>/tools
cd <HEXAGON_SDK_ROOT_DIR>/tools
mv gcc-linaro-4.9-2014.11-x86_64_aarch64-linux-gnu linaro64

Building sample application

1. Copy the directory <FASTCV_ROOT_DIR>/samples/fastcvSimpleTest to the <HEXAGON_SDK_ROOT_DIR>/examples/common/ directory, first you will have to create the common directory, follow the next steps:

mkdir <HEXAGON_SDK_ROOT_DIR>/examples/common
cp -rf <FASTCV_ROOT_DIR>/samples/fastcvSimpleTest <HEXAGON_SDK_ROOT_DIR>/examples/common

2. Run the following command to copy the 64-bit library libfastcv.a to the lib/ folder in the fastcvSimpleTest directory in the Hexagon SDK path:

cp <FASTCV_ROOT_DIR>/lib/64-bit/libfastcv.a <HEXAGON_SDK_ROOT_DIR>/examples/common/fastcvSimpleTest/lib/

3. Open a new terminal in <HEXAGON_SDK_ROOT_DIR> directory and run the following command to setup the local environment:

Note
Notice this will only work as long as you keep the terminal open. You will have to re run this command every time you open a new terminal for development.
source setup_sdk_env.source

You should get something similar to:

user@email:~/work/rnd/qualcomm_robotics_rb5/hexagon_sdk/5.2.0.0$ source setup_sdk_env.source

Setting up the Hexagon SDK environment locally

HEXAGON_SDK_ROOT is : /home/user/work/rnd/qualcomm_robotics_rb5/hexagon_sdk/5.2.0.0

Setting up the QAIC binary for the platform
make: Entering directory '/home/user/work/rnd/qualcomm_robotics_rb5/hexagon_sdk/5.2.0.0/ipc/fastrpc/qaic'
make: Leaving directory '/home/user/work/rnd/qualcomm_robotics_rb5/hexagon_sdk/5.2.0.0/ipc/fastrpc/qaic'
make: Entering directory '/home/user/work/rnd/qualcomm_robotics_rb5/hexagon_sdk/5.2.0.0/ipc/fastrpc/qaic'
make: Leaving directory '/home/user/work/rnd/qualcomm_robotics_rb5/hexagon_sdk/5.2.0.0/ipc/fastrpc/qaic'
Done

4. Change directory to the fastcvSimpleTest:

cd examples/common/fastcvSimpleTest

5. Run the following command to build the binary of the sample application:

make tree V=UbuntuARM_Debug_aarch64

A folder named UbuntuARM_Debug_aarch64 should be created in the current directory, containing the binary.

Running sample application

1. To copy the binary file to the Qualcomm Robotics RB5/RB6 and run it, you can do it either via ADB or SSH. Click on ADB_GUIDE to learn how to connect via ADB or click on SSH_GUIDE to learn how to connect via SSH. In this guide we will show the two ways.

Copy and execute sample application

1. Run the following command to copy the sample:

With ADB:

adb push <HEXAGON_SDK_ROOT_DIR>/examples/common/fastcvSimpleTest/UbuntuARM_Debug_aarch64/ship/fastcvSimpleTest /usr/bin

With SSH:

scp <HEXAGON_SDK_ROOT_DIR>/examples/common/fastcvSimpleTest/UbuntuARM_Debug_aarch64/ship/fastcvSimpleTest root@<RB5_IP_ADDRESS>:/usr/bin

2. Run the following command to access the board:

With ADB, your terminal will start with a # which means you are now inside the board's filesystem:

adb shell

With SSH:

ssh root@<RB5_IP_ADDRESS>

3. Run the following commands to create the output directory where the results of the sample application will be saved, give the app execution permissions and to execute the application:

Note
These commands are executed in the board.
mkdir -p /sdcard/fastcv_simple_test/
chmod 777 /usr/bin/fastcvSimpleTest
/usr/bin/fastcvSimpleTest


Error creating thumbnail: Unable to save thumbnail to destination
Figure 2: FastCV sample application output image


You should see an output like the following, where the application runs a function to scale down a 1920x1080 image to 640x480 and apply Harris Corner Detection to it. The function is executed in two modes, CPU_PERFORMANCE and LOW_POWER, and the output images are located in in the paths highlighted below, the images should look like the one in Figure 2:

Function called from test application: fastcvSimpleTest, OperationMode: CPU_PERFORMANCE
Input image width = 1920, height = 1080  function to call:fastcvSimpleTest
   Execution time of fcvScaleDownMNu8 969 usec
   Execution time of fcvCornerHarrisu8 1550 usec
Average time (us/frame) for fastcvSimpleTest CPU_PERFORMANCE: 2525
Output file can be found at /sdcard/fastcv_simple_test/fastcvSimpleTest_output_OpMode_3.pgm


Function called from test application: fastcvSimpleTest, OperationMode: LOW_POWER
Input image width = 1920, height = 1080  function to call:fastcvSimpleTest
 fastcv_log: SHARED LIB FOUND
 fastcv_log: SHARED LIB FOUND
   Execution time of fcvScaleDownMNu8 2305 usec
   Execution time of fcvCornerHarrisu8 1707 usec
Average time (us/frame) for fastcvSimpleTest LOW_POWER: 3728
Output file can be found at /sdcard/fastcv_simple_test/fastcvSimpleTest_output_OpMode_0.pgm


References

  1. Hexagon DSP SDK - Getting Started. Retrieved January 15, 2023, from [1]


Index