OpenCV Porting on T507 Platform with Linux 4.19: A Deep Comparison Between Standalone Compilation and Buildroot Compilation

Forlinx

Apr 23, 2023
107
Joined
Apr 23, 2023
Messages
107
OpenCV is an open-source computer vision library that provides a rich set of image processing and computer vision algorithms, supporting multi-platform development. It can be used for various computer vision tasks such as image and video processing, feature extraction, object detection, image segmentation, pose estimation, and object recognition. There are two methods for porting OpenCV: standalone compilation and Buildroot compilation.


Standalone Compilation of OpenCV


Standalone compilation requires CMake, a cross-platform build system similar to the commonly used ./configure. Once configured, it generates a CMakeLists.txt file that defines the project's build rules.


1. Install CMake


file.php



2. Configuration


First, extract opencv-2.4.13.7.tar.gz, enter its directory, and run cmake-gui to open the configuration interface.

(1)Set the source code path and build output path (the output path must be created in advance);

file.php


(2)Click Configure and select Unix platform cross-compilation mode;

file.php


(3)Configure compiler settings.

file.php


(4)Configure compiler settings after configuration.

Enable TIFF support.

file.php


Disable CUDA (Compiling with CUDA fails; CUDA is for NVIDIA GPUs, which are not available on T507, so disabling it has no impact).

file.php


Select Grouped to configure the installation path in cmake.

file.php


Cancel GTK

file.php


Reconfigure and generate the build files.

file.php



3. Compilation


Before compiling, modify the CMakeLists.txt file to configure linker rules:

file.php


The goal is to configure the rules for the connector,

-lpthread: Links the libpthread.so library, which provides multithreading support

-lrt: links the librt.so library, which provides real-time extension-related functions

-lrt: links the librt.so library, which provides real-time extension-related functions

make compilation

file.php



4. Installation and Deployment


The installation path needs to be cleared before installation.

make install.

file.php


Generated test program.

file.php


Generated library.

file.php


There is also a part of the build path.

file.php


Package the above content and release it to the file system of the board.


5. Test


The program can be called to the library to run normally.

file.php


However, there are still some errors in the application processing.


Build root compile opencv



1. Enter the Graphical Interface


file.php



2. Select Compilation Parameters


Select opencv3 in the following path

Tick all the parameter items.

file.php



3. Save the .config file.


Go to the output path of the source package/OKT507-linux-sdk/out/t507/okt507/longan/buildroot,

Change the existing target file to any name and create a new target file


4. Standalone Compilation


file.php


Networking is required for the compilation process

Buildroot outputs the standalone compiled content to the previously created **target** directory. The contents can then be packaged and deployed to the **filesystem**.


5. Test


ZD-Atom provides an OpenCV Qt test program based on **i.MX6UL**, where the **.pro** file defines the application's dependencies.

file.php


These libraries are available in the files generated by the compilation.

file.php


Both methods have their pros and cons:

Standalone Compilation: Allows trying different source versions and offers more flexible parameter configuration, but the process is complex.

Buildroot Compilation: Enables easy deployment by simply extracting the generated files, but switching versions is inconvenient.

 
Top