Compiling OpenCV and Developing Applications on the RK3576 Board

2025-09-20

82
This article, provided by developer "Duan Dijun," introduces the development and testing of a compilation solution for OpenCV, along with the setup of its environment, specifically tailored for MYIR's MYD-LR3576 development board, which utilizes the Rockchip RK3576 SoC.
MYD-LR3576 Development Board
The RK3576 SoC features the following configurations:
4x Cortex-A72 cores (up to 2.2GHz)
4x Cortex-A53 cores (up to 1.8GHz)
NPU (AI acceleration unit)
- An Independent NPU with a typical computing power of 6 TOPS (INT8)
- Supports model acceleration for mainstream frameworks such as TensorFlow Lite, PyTorch, and Caffe (requires Rockchip's RKNN Toolkit toolchain).
Therefore, we can run OpenCV code on MYIR's RK3576 development board to perform visual tasks and fully utilize its capabilities. To compile OpenCV, one must first update the software packages and install the necessary dependencies.
sudo apt update
sudo apt upgrade -y
sudo apt install -y build-essential cmake git pkg-config libgtk-3-dev
libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
libxvidcore-dev libx264-dev libjpeg-dev libpng-dev libtiff-dev
gfortran openexr libatlas-base-dev python3-dev python3-numpy
libtbb2 libtbb-dev libdc1394-22-dev libopenexr-dev
libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev
1. Compile the latest version of OpenCV at the board
Clone the OpenCV and OpenCV contrib repositories:
Master Repository (if not cloned)
git clone https://github.com/opencv/opencv.git
cd opencv
git checkout <version, for example 4.9.0> # Optional, specify the version
Contrib Repository (if cloned)
cd /path/to/opencv_contrib # Replace with your contrib path
git checkout <the same version as the master repository>
Create and enter the build folder in the OpenCV main directory:
mkdir build && cd build
Using CMake Configuration (Key Steps):
cmake -D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=/usr/local
-D INSTALL_C_EXAMPLES=ON
-D INSTALL_PYTHON_EXAMPLES=OFF
-D OPENCV_GENERATE_PKGCONFIG=ON
-D OPENCV_EXTRA_MODULES_PATH=/home/myir/Downloads/opencv-4.11.0/opencv_contrib-4.11.0/modules
-D BUILD_EXAMPLES=ON
-D BUILD_opencv_python3=OFF
-D BUILD_opencv_python2=OFF
-D BUILD_NEW_PYTHON_SUPPORT=OFF
-D WITH_GTK=ON
-D WITH_FFMPEG=ON ..
After all preparations are complete, environmental inspection and configuration work will begin.
After no errors are reported, proceed to the next step.
make -j6
It is not advisable to compile using all cores, as this may result in dependency errors due to varying compilation speeds among threads.
After compilation, run "make install" directly to install.
Detection and Installation
Run the built-in routine.
2. Set up the application
First, insert the USB camera and check if it is recognized in the terminal using the command:
Lsusb
If it is recognized normally, you should see the keyword 'camera' in the device list.
Alternatively, install the Cheese app to verify that the camera is functioning properly.
Create a new build folder within the cpp directory by executing the command `mkdir build`. Subsequently, compile the built-in example program using the provided command:
cd build
cmake ..
make-j8
You can first test if the OpenCV environment is functioning properly.
Enter
./example_opencv to open the above command, proving that there is no problem with the system's cv environment.
Performance Test
In the hog test, the average frame rate of DNN acceleration is about 10 fps with 8 CPUs almost at full load, which is slightly lower than the Raspberry Pi 5.
The average time in the tapi test environment is 68 ms.
2025-08-30
MYIR T536 Development Board: Multi-protocol IoT Gateway Solution Test
The article details the development and testing of a multi-protocol IoT gateway solution that utilizes MYIR's MYD-LT536 development board, which is based on the Allwinner T536 SoC.
2025-08-29
MYIR RK3576 Development Board: 12-Channel 1080p HD Video Streaming
MYIR has successfully achieved efficient H.264 encoding and low-latency RTSP streaming for 12-channel HD video streams on the Rockchip RK3576 SOM.
2025-08-07
Compiling Kernel for MYD-LMX9X Development Board
This guide walks you through building a Linux kernel for the MYIR MYD-LMX9X Development Board
2025-06-23
RZ/G2L-Based MYD-YG2LX System Startup Time Optimization Application Notes
This article introduces a debugging case for optimizing system boot time based on the MYD-YG2LX development board.
2025-06-23
How to Implement an Environmental Monitoring System on the STM32MP257 Board
This article introduces how to use MYIR's MYD-LD25X development board (MYIR's STM35MP257-based development board) to implement a simple environmental monitoring system.
2025-06-17
OpenCV Pedestrian Detection Application Solution Based on MYIR's T527 Development Board
In this article, we will introduce the testing of OpenCV pedestrian detection solution based on MYIR's MYD-LT527 Development Board (based on Allwinner T527 processor).
2024-09-23
Ethernet Driver Porting Guide Based on MYIR's NXP i.MX.93 Development Board
Ethernet Driver Porting Guide Based on MYIR's NXP i.MX.93 Development Board MYD-LMX9X
2024-08-16
QT Development Guide for NXP i.MX 93 Development Board by MYIR
1. OverviewQt is a cross-platform graphical application development framework that is applied to devices and platforms of different sizes, while providing different license versions for users to choos
2024-06-16
Application Notes | Setting up OTA Functionality on MYIR's NXP i.MX 93 Development Board
1. OverviewOver-the-Air Technology (OTA) is a technology that enables remote management of mobile terminal equipment and SIM card data via the air interface of mobile communication. In this article, O