linux安装OpenCV
时间: 2023-11-20 15:57:52 浏览: 304
Linux环境下的OpenCV安装
以下是在Linux环境下安装OpenCV的步骤:
1.更新系统软件包
```shell
sudo apt-get update
sudo apt-get upgrade
```
2.安装OpenCV依赖项
```shell
sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
```
3.下载OpenCV源代码
```shell
cd ~
git clone https://github.com/opencv/opencv.git
```
4.编译和安装OpenCV
```shell
cd opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j$(nproc)
sudo make install
```
5.测试OpenCV是否安装成功
```shell
ldconfig -v | grep opencv
```
如果输出中包含“libopencv_***.so”,则表示OpenCV已经成功安装。
阅读全文