Files
blog/source/_posts/2026/2026.3/opencv-install.md
bisnsh b3d97ec5ac
All checks were successful
自动部署 / deploy (push) Successful in 6m18s
update 260314
2026-03-14 20:24:07 +08:00

50 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: 配置opencv
cover: https://pic.biss.click/image/c177a2e2-63af-4582-98b6-e95726f6cdc5.webp
categories:
- 技术
series: opencv
tags: opencv
abbrlink: 6e3332b
summary: >-
这篇文章介绍了在Ubuntu和Windows系统上配置OpenCV的过程。在Ubuntu系统中通过包管理器安装了Visual
Studio、GCC、G++、OpenCV以及Python的OpenCV绑定。而在Windows系统中则通过安装Visual
Studio并下载OpenCV的Windows安装包进行配置包括将安装路径添加到系统环境变量中。
date: 2026-03-14 11:48:36
---
# 引言
不知道为什么我们专业看起来与计算机八竿子打不着,竟然要学`opencv`,那就来记录一下吧!
# Ubuntu 篇
`Ubuntu`因为有完善的包管理体系,所以配环境相对简单。
先安装`vscode`,当然也可以不安装,只是个编辑器;
{% link vscode,Microsoft,https://code.visualstudio.com/ %}
到这里下载`deb`格式的软件包,然后`dpkg`安装即可。可以安装这些扩展:
<center><img src=https://pic.biss.click/image/3369ff6a-3286-4ccd-b261-a38802f7d9f2.webp)></center>
接下来安装编译器
```bash
# 先更新软件包
apt update
apt upgrade -y
# 安装C/C++编译器
apt install gcc g++
# 安装opencv
apt install -y mesa-utils
apt install -y libopencv-dev
apt install -y opencv
apt install -y python3-opencv #Python opencv
```
然后就可以了。
# Windows 篇
`Windows` 下需要安装`Visual Studio`比较简单官网下载安装就行。选择使用C++桌面开发就行。
下载`opencv`,在下边网站下载`Windows`安装包,
{% link opencv,opencv,https://opencv.org/releases/ %}
下载后是一个自解压包,解压路径设置成自己想要的路径,
把安装路径添加到系统环境变量中,例如`D:\Opencv\opencv\build\x64\vc16\bin`
然后应该就没问题了。