Ubuntu20.04 安装 opencv
opencv
OpenCV: 开源计算机视觉库
项目地址:https://gitcode.com/gh_mirrors/opencv31/opencv
·
Ubuntu20.04 安装 opencv
下载源码
https://opencv.org/releases/
官网下载

这里下载的是3.4.16
安装依赖项
sudo apt-get install build-essential libgtk2.0-dev libjpeg-dev libtiff5-dev libopenexr-dev libtbb-dev4
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libgtk-3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev pkg-config
报错解决
安装libgtk-3-dev时报错
The following packages have unmet dependencies:
libgtk-3-dev :
Depends: gir1 …
…
Depends: libgtk-3-0 (= 3.24.20-0ubuntu1) but 3.24.20-1 is to be installed
我用的是阿里源,可能是阿里源的版本过新,不兼容。
解决:
编辑/etc/apt/sources.list文件
在最后一行加入:
deb http://archive.ubuntu.com/ubuntu focal-updates main
运行:
sudo apt update
再次尝试安装,即可成功
编译和安装
解压压缩包
unzip opencv-3.4.16.zip
进入解压文件夹,并运行cmake
cd opencv-3.4.16
mkdir build
cd build
cmake ..
开始编译
make -j8

sudo make install

安装成功
OpenCV: 开源计算机视觉库
最近提交(Master分支:3 个月前 )
23fcea0d
Missing include directories needed for wayland-util and xkbcommon #26563
See: #26561
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
1 天前
03cedee0
Fixed several cases of unaligned pointer cast 3 天前
更多推荐

所有评论(0)