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

相关推荐
jndingxin12 分钟前
OpenCV 图形API(11)对图像进行掩码操作的函数mask()
人工智能·opencv·计算机视觉
阳光_你好40 分钟前
请详细说明opencv/c++对图片缩放
c++·opencv·计算机视觉
契合qht53_shine1 小时前
OpenCV 从入门到精通(day_05)
人工智能·opencv·计算机视觉
xcLeigh1 小时前
OpenCV从零开始:30天掌握图像处理基础
图像处理·人工智能·python·opencv
新知图书3 小时前
OpenCV单窗口显示多图片
人工智能·opencv·计算机视觉
荷包蛋蛋怪3 小时前
【北京化工大学】 神经网络与深度学习 实验6 MATAR图像分类
人工智能·深度学习·神经网络·opencv·机器学习·计算机视觉·分类
QQ_7781329743 小时前
OpenCV引擎:驱动实时应用开发的科技狂飙
opencv·计算机视觉
羑悻的小杀马特6 小时前
OpenCV 引擎:驱动实时应用开发的科技狂飙
人工智能·科技·opencv·计算机视觉
蹦蹦跳跳真可爱5896 小时前
Python----计算机视觉处理(Opencv:道路检测之提取车道线)
python·opencv·计算机视觉
qp14 小时前
21.OpenCV获取图像轮廓信息
javascript·opencv·webpack