Ubuntu 22.04 develops OpenCV ncnn tengin-lite environment to build

1.Basic instructions

Both ncnn and tengine are high-performance neural network inference computing frameworks that deploy neural network models to the embedded side. Opencv is a well-known image processing C++ function library. ncnn and tengine do not need to rely on opencv. Because opencv has perfect support for basic image operations, opencv is used in the official sample programs of ncnn and tengine, so they are explained together here. If you need to compile ncnn and tengine, you need to compile and install opencv first.

  1. OpenCV development environment setup (OpenCV compilation and installation)

1. Download opencv from gitee

sudo apt-get install git
sudo apt-get install libgtk2.0-dev and pkg-config
sudo apt install libavcodec-dev libavformat-dev libswscale-dev libavutil-dev #ffmpeg开发包安装
https://gitee.com/mirrors/opencv/repository/archive/3.4.7.zip

2. Compile opencv

cd opencv-3.4.7/
mkdir build
cd build 
mkdir output    #编译后安装到这个目录
sudo apt install cmake -y #安装cmake
cmake .. -DCMAKE_INSTALL_PREFIX=./output/   #生成配置文件Makefile/安装完成make install 可以拷贝库文件到output目录,或者不申明直接安装 sudo make install可以省略步骤3,默认安装更好一些
make -j8 #编译opencv
make install #安装opencv 到 output目录

Note: Need to download during the process

IPPICV: Download: ippicv_2019_lnx_intel64_general_20180723.tgz

It will be faster to download via mobile phone network.

3.Install opencv

Enter the opencv installation directory output

sduo cp -r ./lib/* /usr/lib/
sudo cp -r ./include/* /usr/include/

The configuration is completed as shown below:

Problems encountered:

Re-execute make

The compilation is completed as shown below:

make install is completed as shown below:

  1. ncnn compilation and installation

  1. Downloadncnn

https://gitee.com/Tencent/ncnn/repository/archive/master.zip
  1. Compile ncnn

cd 
mkdir build
cd build
cmake .. -DNCNN_BUILD_EXAMPLES=ON #编译ncnn例子,make install后安装在install example文件夹
make -j8
make install 
  1. Install ncnn development package

sudo cp ./install/lib/libncnn.a /usr/lib 
sudo cp -r ./install/include/* /usr/include/

The configuration is completed as shown below:

The compilation is completed as shown below:

make install is completed as shown below:

3. Compile and install tengine-lite

1. Download tengine-lite

https://gitee.com/OAL/Tengine/repository/archive/tengine-lite.zip

2. Compile tengine-lite

cd Tengine-tengine-lite/
mkdir build

Modify cmakelists.list

cd build
cmake ..
make install

The compilation is completed as shown below:

As shown in the figure after installation:

3. Install tengine-lite development package

sudo cp -r ./include/* /usr/include/
sudo cp -r ./lib/* /usr/lib/

Note: When calling the above function library, you need to link the library, otherwise the compilation will not pass or it will not run.

Guess you like

Origin blog.csdn.net/klp1358484518/article/details/129080945