下载源码
opencv版本:https://github.com/opencv/opencv/releases
opencv_contrib版本:https://github.com/opencv/opencv_contrib
注意右边tag里选择版本
将opencv_contrib_x.x.x复制到opencv_x.x.x文件夹中,重命名为opencv_contriba
安装
cmake -D CMAKE_INSTALL_PREFIX=/usr/local -D CMAKE_BUILD_TYPE=Release -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules WITH_CUDA=ON ..
然后
make -j8
然后
sudo make install