1、由于学习需要,需要安装opencv4.5,只能源码安装,环境为manjaro linux, 2020年11月2日最新升级到testing版本
2、下载文件:git clone https://github.com/opencv/opencv.git或者https://github.com/opencv/opencv/archive/4.5.0.zip压缩包都可以,如果时zip文件,记得先解压
可能要安装依赖:
FFmpeg-4.3.1, gst-plugins-base-1.18.1, GTK+-3.24.23, JasPer-2.0.14, libjpeg-turbo-2.0.5, libpng-1.6.37, LibTIFF-4.1.0, libwebp-1.1.0, v4l-utils-1.20.0, and xine-lib-1.2.10 apache-ant-1.10.9, Doxygen-1.8.20, Java-14.0.1, Python-2.7.18, Cuda, Eigen, OpenEXR, GCD, GDAL, GigEVisionSDK, JACK, libdc1394, libgphoto2, NumPy, OpenNI, PlanetUML, PvAPI, Threading Building Blocks (TBB), UniCap, VTK - The Visualization Toolkit, and XIMEA
3、进入下载或解压后的目录,例如:cd ~/opencv4.5, 新建目录build编译目录,进入编译目录:cd build
4、cmake -DCMAKE_EXE_LINKER_FLAGS=-lcblas -DCMAKE_BUILD_TYPE=Release -DOPENCV_GENERATE_PKGCONFIG=ON -DCMAKE_INSTALL_PREFIX=/usr/local .. 很快就会生成cmake文件
5、编译安装:
make -j8
sudo make install
6、配置: