
OpenCV Porting on T507 Platform with Linux 4.19: A Deep Comparison Between Standalone Compilation and Buildroot Compilation
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
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);
(2)Click Configure and select Unix platform cross-compilation mode;
(3)Configure compiler settings.
(4)Configure compiler settings after configuration.
Enable TIFF support.
Disable CUDA (Compiling with CUDA fails; CUDA is for NVIDIA GPUs, which are not available on T507, so disabling it has no impact).
Select Grouped to configure the installation path in cmake.
Cancel GTK
Reconfigure and generate the build files.
3. Compilation
Before compiling, modify the CMakeLists.txt file to configure linker rules:
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
4. Installation and Deployment
The installation path needs to be cleared before installation.
make install.
Generated test program.
Generated library.
There is also a part of the build path.
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.
However, there are still some errors in the application processing.
Build root compile opencv
1. Enter the Graphical Interface
2. Select Compilation Parameters
Select opencv3 in the following path
Tick all the parameter items.
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
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.
These libraries are available in the files generated by the compilation.
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.