opencv 构建依赖

技术 · 05-28 · 271 人浏览

依赖安装

sudo apt-get install build-essential cmake pkg-config
sudo apt-get install libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
sudo apt-get install libgtk-3-dev
sudo apt-get install libatlas-base-dev gfortran

# 调试
sudo apt-get install gdb

构建脚本

git clone -b 4.9.0 https://github.com/opencv/opencv.git
git clone -b 4.9.0 https://github.com/opencv/opencv_contrib.git

cd opencv
mkdir build
cd build

cmake -D CMAKE_BUILD_TYPE=RELEASE \
      -D CMAKE_INSTALL_PREFIX=/usr/local \
      -D INSTALL_C_EXAMPLES=ON \
      -D INSTALL_PYTHON_EXAMPLES=OFF \
      -D OPENCV_GENERATE_PKGCONFIG=ON \
      -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
      -D BUILD_EXAMPLES=OFF \
      -D BUILD_SHARED_LIBS=ON ..

#      -D WITH_LAPACK=OFF \
#      -D WITH_EIGEN=OFF \
#      -D WITH_IPP=OFF \
#      -D BUILD_IPP_IW=OFF \
#      -D WITH_ZLIB=OFF \
#      -D BUILD_ZLIB=OFF \
#      -D WITH_JPEG=ON \
#      -D BUILD_JPEG=ON \
#      -D WITH_PNG=ON \
#      -D BUILD_PNG=ON \
#      -D WITH_TIFF=ON \
#      -D BUILD_TIFF=ON \
#      -D CMAKE_INSTALL_LIBDIR=lib64 \

make -j$(nproc)

sudo make install
Theme Jasmine