cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=ON -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON D OPENCV_EXTRA_MODULES_PATH=../opencv/opencv_contrib/modules -D BUILD_EXAMPLES=ON -D OPENCV_GENERATE_PKGCONFIG=YES ..
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=ON -D CUDA_ARCH_BIN='7.5' -D WITH_CUDA=ON -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D OPENCV_EXTRA_MODULES_PATH=/home/qiang/Documents/opencv/opencv_contrib/modules -D BUILD_EXAMPLES=ON -D OPENCV_GENERATE_PKGCONFIG=YES ..
https://blog.csdn.net/hehern/article/details/103577553
安装opencv时遇到boostdesc缺失的问题
安装所需要的依赖
sudo apt-get install -y build-essential checkinstall cmake pkg-config yasm git gfortran libtiff5-dev ibavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine2-dev libv4l-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev qt5-default libgtk2.0-dev libtbb-dev libatlas-base-dev libfaac-dev libmp3lame-dev libtheora-dev libvorbis-dev libxvidcore-dev libopencore-amrnb-dev libopencore-amrwb-dev x264 v4l-utils
另外一个依赖,可能需要更新源,不一定成功
sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main”
sudo apt-get update
sudo apt-get install -y libjpeg8-dev libjasper-dev libpng12-dev
执行cmake
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=ON -D CUDA_ARCH_BIN='7.2' -D WITH_CUDA=ON -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D OPENCV_EXTRA_MODULES_PATH=/home/qiang/Documents/opencv/opencv_contrib/modules -D BUILD_EXAMPLES=ON -D OPENCV_GENERATE_PKGCONFIG=YES ..
查看核心数量:nproc
执行make -j8
执行sudo make install
执行配置
sudo sh -c 'echo "/usr/local/lib" >> /etc/ld.so.conf.d/opencv.conf’
sudo ldconfig
如果上述配置成功,则会在/usr/local/lib/文件夹中出现一个pkgconfig文件夹,里面有一个opencv.pc文件,内容大致如下:
includedir_old=${prefix}/include/opencv4/opencv2
IMPORTANT
I believe that in my case this occured because my cmake version had no HTTPS support. To fix this, you have to install or build cmake with HTTPS support. In my case the easiest way was to build cmake from sources against system's own curl (which has HTTPS support):
wget --no-check-certificate https://cmake.org/files/v3.9/cmake-3.9.0.tar.gz
tar -zxvf cmake-3.9.0.tar.gz
cd cmake-3.9.0
need to build against system curl to get https support
-> install devel packages
yum -y install curl-devel zlib-devel
./bootstrap --system-curl
make && make install
I think that opencv-contrib's cmake should fail with a better error message if there's no HTTPS support.
网友评论