这里是我OpenCV课程的相关资料,后面还会不断补充…
Windows下编译OpenCV
下载必要的工具和库
- 安装python3和numpy库,下载地址:
1
https://www.python.org/ftp/python/3.9.2/python-3.9.2-amd64.exe
- 安装 VS, 社区版即可,下载地址:
1
https://visualstudio.microsoft.com/zh-hans/downloads/
- 安装 cmake,下载地址:
1
https://github.com/Kitware/CMake/releases/download/v3.20.0-rc1/cmake-3.20.0-rc1-windows-x86_64.msi
- 下载IPPICV
1
https://github.com/opencv/opencv_3rdparty.git
下载opencv源码,下载地址:
- opencv源码地址:
1
git clone https://github.com/opencv/opencv.git
- opencv-contrib源码地址git:
1
clone https://github.com/opencv/opencv_contrib.git
编译方法:
- 在存放opencv源码目录中创建build目录
- 运行cmake
- 选择opencv源码目录
- 选择编译目录
- 选择CPU架构
- 增加opencv-contrib选项, OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules
- 检查编译选项
- 勾选 opencv_world
- 生成编译脚本
打开opencv工程文件
- 选择输出版本类型
- 进行编译
Ubuntu下编译OpenCV4
安装开发工具
1
$ sudo apt-get install build-essential cmake unzip pkg-config
安装image and video I/O libraries
1
2
3$ sudo apt-get install libjpeg-dev libpng-dev libtiff-dev
$ sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
$ sudo apt-get install libxvidcore-dev libx264-dev安装GUI
1
$ sudo apt-get install libgtk-3-dev
安装数据优化包
1
$ sudo apt-get install libatlas-base-dev gfortran
安装 Python 3
1
$ sudo apt-get install python3-dev