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

相关推荐
西猫雷婶3 小时前
python学opencv|读取图像(四十一 )使用cv2.add()函数实现各个像素点BGR叠加
开发语言·python·opencv
bohu8317 小时前
OpenCV笔记3-图像修复
笔记·opencv·图像修复·亮度增强·图片磨皮
通信.萌新18 小时前
OpenCV边沿检测(Python版)
人工智能·python·opencv
PaLu-LI19 小时前
ORB-SLAM2源码学习:Initializer.cc⑧: Initializer::CheckRT检验三角化结果
c++·人工智能·opencv·学习·ubuntu·计算机视觉
pchmi1 天前
C# OpenCV机器视觉:红外体温检测
人工智能·数码相机·opencv·计算机视觉·c#·机器视觉·opencvsharp
AI视觉网奇1 天前
python 统计相同像素值个数
python·opencv·计算机视觉
hunter2062061 天前
用opencv生成视频流,然后用rtsp进行拉流显示
人工智能·python·opencv
冰万森2 天前
【图像处理】——掩码
python·opencv·计算机视觉
Antonio9152 天前
【opencv】第10章 角点检测
人工智能·opencv·计算机视觉
大哥喝阔落2 天前
图片专栏——曝光度调整相关
人工智能·python·opencv