码迷,mamicode.com
首页 > 系统相关 > 详细

ubuntu18 build opencv4 from source

时间:2021-01-13 10:46:58      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:cuda   cmak   gtk   base   oca   nump   -bash   test   compiler   

1 安装依赖

## Install dependencies
sudo apt -y install build-essential checkinstall cmake pkg-config yasm
sudo apt -y install git gfortran
sudo apt -y install libjpeg8-dev libpng-dev

sudo apt -y install software-properties-common
sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
sudo apt -y update

sudo apt -y install libjasper1
sudo apt -y install libtiff-dev

sudo apt -y install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev
sudo apt -y install libxine2-dev libv4l-dev
cd /usr/include/linux
sudo ln -s -f ../libv4l1-videodev.h videodev.h
cd ~ sudo apt -y install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev sudo apt -y install libgtk2.0-dev libtbb-dev qt5-default sudo apt -y install libatlas-base-dev sudo apt -y install libfaac-dev libmp3lame-dev libtheora-dev sudo apt -y install libvorbis-dev libxvidcore-dev sudo apt -y install libopencore-amrnb-dev libopencore-amrwb-dev sudo apt -y install libavresample-dev sudo apt -y install x264 v4l-utils # Optional dependencies sudo apt -y install libprotobuf-dev protobuf-compiler sudo apt -y install libgoogle-glog-dev libgflags-dev sudo apt -y install libgphoto2-dev libeigen3-dev libhdf5-dev doxygen

# Python dependencies
sudo apt -y install python3-dev python3-pip sudo -H pip3 install -U pip numpy sudo apt -y install python3-testresources

2 编译
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=./install \
    -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.1.0/modules \
    -D OPENCV_ENABLE_NONFREE=ON \
    -D BUILD_opencv_python2=OFF \
    -D BUILD_opencv_python3=ON \
    -D WITH_CUDA=ON \
    -D BUILD_opencv_cudacodec=OFF \
    -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-10.1 \
    -D CUDA_ARCH_BIN="6.0 6.1 7.0 7.5" -D CUDA_ARCH_PTX="" \
    -D INSTALL_C_EXAMPLES=ON \
    -D BUILD_EXAMPLES=ON .. make -j4

ubuntu18 build opencv4 from source

标签:cuda   cmak   gtk   base   oca   nump   -bash   test   compiler   

原文地址:https://www.cnblogs.com/gris/p/14261556.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!