Ubuntu20.04安装OpenCV4.4.0—勤劳的搬运工

系统

  • ubuntu20.04
  • opencv4.4.0

安装依赖

udo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

下载代码

git clone https://github.com/opencv/opencv.git
git clone https://github.com/opencv/opencv_contrib.git

编译

  • 把opencv_contrib放到opencv文件夹中
  • 在opencv文件夹中打开终端
cd ~/opencv
mkdir build
cd build
// 如果想自定义安装路径可以设置CMAKE_INSTALL_PREFIX,然后设置.bashrc包含lib路径
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules -D DOPENCV_GENERATE_PKGCONFIG=ON ..
make -j4
//自定义在home文件夹下的话不用sudo
sudo make install
sudo ldconfig

你可能感兴趣的:(开源库安装)