欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 财经 > 金融 > ubuntu20.04 上 opencv4 源码编译安装

ubuntu20.04 上 opencv4 源码编译安装

2024/10/26 2:30:36 来源:https://blog.csdn.net/long630576366/article/details/142876165  浏览:    关键词:ubuntu20.04 上 opencv4 源码编译安装

下载:
1、opencv 4.9
2、opencv_contrilb 4.x

基础依赖库

sudo apt install -y cmake make
sudo apt install -y build-essential
sudo apt install -y libgtk2.0-dev
sudo apt install -y libavcodec-dev
sudo apt install -y libavformat-dev
sudo apt install -y libjpeg-dev
sudo apt install -y libtiff-dev
sudo apt install -y libswscale-dev
sudo apt install -y libpng-dev

sudo add-apt-repository ‘deb http://security.ubuntu.com/ubuntu xenial-security main’
sudo apt update
sudo apt install libjasper1 libjasper-dev
sudo apt install -y freeglut3-dev
sudo apt install -y libgl1-mesa-dev
sudo apt install -y pkg-config

sudo apt update
sudo apt install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev libgstreamer-plugins-good1.0-dev
sudo apt install -y gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly
sudo apt install -y gstreamer1.0-tools gstreamer1.0-libav
sudo apt install -y gstreamer1.0-doc gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio

# 安装gtk2支持
sudo apt-get install libgtk2.0-dev
# 安装gtk3支持
sudo apt-get install libgtk-3-dev

编译

mkdir build
cd build

sudo cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D OPENCV_GENERATE_PKGCONFIG=ON \ -D BUILD_EXAMPLES=OFF \ -D INSTALL_PYTHON_EXAMPLES=OFF \ -D INSTALL_C_EXAMPLES=OFF \ -D WITH_GSTREAMER=ON \ -D OPENCV_EXTRA_MODULES_PATH=/home/a/opencv-4.9.0/opencv_contrib-4.x/modules/ …

sudo make
sudo make install

检查

pkg-config opencv4 --modversion

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com