OpenCV porting tutorial based on Chuanglong AM437x development board

Some of the AM437x routines use the OpenCV library. If you don't use the OpenCV library during development, you can choose not to port OpenCV. This development and transplantation uses the Chuanglong TL437x-IDK development board, which is based on TI AM437x ARM Cortex-A9 CPU, with a main frequency of up to 1GHz.

You can learn about it at this address http://tronlong.com/index.php?g=home&m=product&a=index&id=156

--Has 4 PRU co - processors, supports EtherCAT , PROFINET , PROFIBUS , EtherNet /IP , EnDat , POWERLINK and other industrial protocols;

--Support 2 Gigabit Ethernet ports for network debugging , data transmission, industrial Ethernet master station ;

--Support 2 PRU Fast Ethernet ports for network debugging, data transmission, industrial Ethernet slave station ;

--5 input and 5 output PRU IO interface for industrial communication, industrial control and industrial drive applications;

--With 2 -way CAN , 1 -way camera, UART , RS485 and other industrial control buses and interfaces, suitable for various industrial


Introduction to OpenCV

The full name of OpenCV is: Open Source Computer Vision Library. OpenCV is a cross-platform computer vision library released under the BSD license (open source) and can run on Linux, Windows and Mac OS operating systems. It is lightweight and efficient - it consists of a series of C functions and a small number of C++ classes, and provides interfaces in languages ​​such as Python, Ruby, and MATLAB, and implements many general algorithms in image processing and computer vision.

Unzip OpenCV2.4.11

The version of OpenCV ported this time is OpenCV-2.4.11. Copy the opencv-2.4.11.zip compressed file to the "/home/tronlong/AM437x" directory of Ubuntu, enter the path where the file is located, and execute the following command to decompress the opencv-2.4.11.zip, the file will be decompressed in the current directory .

Host#  unzip opencv-2.4.11.zip

Configure and compile OpenCV2.4.11

Enter the source code directory and create a new build directory for storing working files. Execute the following commands in sequence:

Host#  cd opencv-2.4.11

Host#  mkdir build

Host#  cd build


In the build directory, create a new configuration file arm-linux-gnueabihf.cmake.

n If you use V01.00.00.03 version of Linux Processor-SDK, please write the following:

# the name of the target operating system

SET(CMAKE_SYSTEM_NAME Linux)

# which C and C++ compiler to use

SET(CMAKE_C_COMPILER/home/tronlong/ti-processor-sdk-linux-am437x-evm-01.00.00.03/linux-devkit/sysroots/i686-arago-linux/usr/bin/arm-linux-gnueabihf-gcc)

SET(CMAKE_CXX_COMPILER /home/tronlong/ti-processor-sdk-linux-am437x-evm-01.00.00.03/linux-devkit/sysroots/i686-arago-linux/usr/bin/arm-linux-gnueabihf-g++)

# here is the target environment located

SET(CMAKE_FIND_ROOT_PATH /home/tronlong/ti-processor-sdk-linux-am437x-evm-01.00.00.03/linux-devkit/sysroots/cortexa9t2hf-vfp-neon-linux-gnueabi/usr/lib)

# adjust the default behaviour of the FIND_XXX() commands:

# search headers and libraries in the target environment, search

# programs in the host environment

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)

set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)

Please modify the red content to the actual cross-compilation toolchain and system library file path of the Linux Processor-SDK installation package of the corresponding platform. When copying the above content from the document, the instructions may have line breaks, please check carefully when copying.

Execute the following command to install the compile plugin:

Host#sudo apt-get install cmake

Execute the following commands in the build directory to configure and generate a makefile:

Host#cmake -DWITH_OPENCL=OFF -DWITH_OPENMP=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DCMAKE_INSTALL_PREFIX=/home/tronlong/AM437x/opencv-2.4.11 -DCMAKE_TOOLCHAIN_FILE=arm-linux-gnueabihf.cmake ..




Execute the make command to compile the OpenCV library file for the AM437x platform. The result is shown in the following figure:

Host#  make



Execute the following instructions to install the OpenCV library files into the "opencv-2.4.11/lib" directory.

Host#make install

After the installation is complete, it will look like the following picture:



Install the OpenCV library to the development board

Copy all the files in the "opencv-2.4.11/lib" directory to the "/usr/lib" directory of the development board file system to run OpenCV-based related routines on the development board.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324931710&siteId=291194637