1.基础工具安装
①Ubuntu虚拟机下交叉编译工具链安装
香橙派5Pro为Arm64位架构,因此需要安装g++-aarch64-linux-gnu以及gcc-aarch64-linux-gnu(有其它交叉编译器,本文以此编译器为例)
更新软件源
点击查看交叉编译工具链安装
②安装CMake工具
sudo apt-get install cmake
- Opencv
①下载码源
url: https://github.com/opencv/opencv
解压后创建build目录
进入build目录,创建opencv_install目录(用于存放编译后的lib和include)
②安装编译opencv相关依赖
sudo apt install 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 libopenblas-dev liblapack-dev libprotobuf-dev protobuf-compiler libgoogle-glog-dev libgflags-dev libgphoto2-dev libeigen3-dev libhdf5-dev doxygen
③使用cmake-gui编译
$ cmake-gui
{spa.omeuamoreverde.com]
{spa.palfee.com]
{spa.dai9rounoie.com]
{spa.osuwaribaby.com]
{spa.peermuch.com]
详细配置可参考B站up视频(OPENCV_GENERATE_PKGCONFIG推荐勾选)
链接 https://www.bilibili.com/video/BV1it4y1H7D4/?spm_id_from=333.1007.top_right_bar_window_default_collection.content.click
经过上述步骤可在build目录下生成makefile,执行make命令即可(j4表示同时进行4个构建任务)(推荐j4,j8编译时可能会出现内存不够的情况,具体查看虚拟机配置)
sudo make -j4
make完成后
sudo make install
④结果图
⑤设置环境变量
参考博客 https://www.cnblogs.com/Rubyen2333/p/17337164.html
- 结尾
本文暂时只补充这些内容,等后续空闲出来了,考虑发布一个从0搭建的文章教程,同时考虑将opencvsharp移植至香橙派中