如果没有文件 /usr/local/include/opencv4/opencv2/dnn/dnn.hpp
则需要安装opencv-4.1.0
(一)安装依赖
sudo yum install gcc gcc-c++
sudo yum install cmake3
sudo yum install gtk2-devel
sudo yum install gtk3-devel
sudo yum install ant
(二)下载源码opencv-4.1.0.zip
cd /usr/local/
unzip opencv-4.1.0.zip
cd /usr/local/opencv-4.1.0/
mkdir build
cd build
编译&安装
sudo cmake3 -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_PYTHON_EXAMPLES=ON -D INSTALL_C_EXAMPLES=OFF -D OPENCV_ENABLE_NONFREE=ON -D WITH_CUDA=ON -D WITH_CUDNN=ON -D OPENCV_DNN_CUDA=ON -DBUILD_opencv_cudacodec=OFF -D OPENCV_EXTRA_MODULES_PATH=/usr/local/opencv_contrib-4.1.0/modules/ -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D CUDA_ARCH_BIN=7.5 -D WITH_CUBLAS=1 -D HAVE_opencv_python3=ON -D PYTHON_EXECUTABLE=~/anaconda3/envs/face/bin/python -D BUILD_EXAMPLES=OFF -D WITH_EIGEN=ON -D WITH_V4L=ON -D WITH_NVCUVID=1 -D WITH_FFMPEG=ON -D ENABLE_AVX=ON -D WITH_IPP=ON -D WITH_TBB=ON -D WITH_OPENGL=ON -D WITH_OPENCL=ON ..
sudo make -j8
sudo make install