安装opencv软件包
时间: 2023-11-05 12:02:43 浏览: 149
opencv安装包
Opencv是一个开源计算机视觉库,提供了许多用于处理图像和视频的函数和算法。以下是在Ubuntu上安装OpenCV的步骤:
1.更新软件包列表:
sudo apt-get update
2.安装OpenCV的依赖项:
sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
3.安装OpenCV的Python支持:
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
4.下载OpenCV源代码:
git clone https://github.com/opencv/opencv.git
5.创建build目录:
cd opencv
mkdir build
cd build
6.使用cmake构建OpenCV:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
7.编译OpenCV:
make -j4
8.安装OpenCV:
sudo make install
9.添加OpenCV的库路径:
sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig
现在您已经成功安装了OpenCV。
阅读全文