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