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

相关推荐
(●'◡'●)知2 小时前
基于树莓派的安保巡逻机器人--(一、快速人脸录入与精准人脸识别)
人工智能·python·opencv·机器学习·计算机视觉
joker_man11 天前
使用DeepLabV3实现植叶病害检测
人工智能·python·opencv·conda
努力减肥的小胖子51 天前
opencv - py_photo - py_non_local_means 非局部均值去噪
opencv·均值算法
fogota1 天前
OpenCV中的坐标运算 [C#]
人工智能·opencv·c#
橘色的喵1 天前
C++基于opencv的视频质量检测--遮挡检测
c++·opencv·音视频·遮挡检测·occlusiondetect·视频质量
梦里水乡8571 天前
MATLAB+opencv人脸疲劳检测
开发语言·opencv·matlab
可均可可1 天前
C++之OpenCV入门到提高002:加载、修改、保存图像
opencv·imread·imwrite·imshow
jndingxin2 天前
OpenCV视觉分析之目标跟踪(2)卡尔曼滤波器KalmanFilter的使用
人工智能·opencv·目标跟踪
努力减肥的小胖子52 天前
opencv - py_imgproc - py_geometric_transformations 几何变换
opencv·几何变换
努力减肥的小胖子52 天前
opencv - py_imgproc - py_filtering filtering 过滤-卷积平滑
opencv