文章目录
版本
opencv 3.4
编译
shell
# 下载代码
git clone https://github.com/opencv/opencv.git
git clone https://github.com/opencv/opencv_contrib.git # 扩展包,不需要可省略相关步骤
# 版本切换
cd opencv
git checkout 3.4.0 --force
cd ../opencv_contrib
git checkout 3.4.0 --force
cd ../opencv
# 编译
mkdir build && cd build
cmake .. -DBUILD_JAVA=OFF -DBUILD_opencv_apps=OFF -DBUILD_opencv_python_bindings_generator=OFF -DBUILD_opencv_python3=OFF -DBUILD_PNG=ON -DBUILD_JPEG=ON -DBUILD_ZLIB=ON -DBUILD_TIFF=ON -DWITH_GTK_2_X=ON \
-DCMAKE_INSTALL_PREFIX=/usr/local/opencv_3.4.0
make
sudo make install
# 使用
LIST(APPEND CMAKE_PREFIX_PATH /home/ubuntu/local/opencv-3.4.0)
find_package(OpenCV 3.4.0)