在Ubuntu系统上安装opencv
时间: 2023-06-12 15:02:17 浏览: 105
您好,针对您的问题,可以按照以下步骤在Ubuntu系统上安装OpenCV:
1. 打开终端并更新系统:sudo apt-get update && sudo apt-get upgrade
2. 安装基本依赖项和工具,包括OpenCV构建工具:sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
3. 安装OpenCV所需的依赖项:sudo apt-get install libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
4. 在终端上输入以下命令克隆OpenCV GitHub存储库:git clone https://github.com/opencv/opencv.git
5. 进入OpenCV目录并克隆额外的存储库:cd opencv && git clone https://github.com/opencv/opencv_contrib.git
6. 进入opencv目录并创建build目录:cd ~/opencv && mkdir build && cd build
7. 运行cmake,其中包括opencv_contrib路径:cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=~/opencv/opencv_contrib/modules ..
8. 编译OpenCV:make -j4
9. 安装OpenCV:sudo make install
完成以上步骤后,您的Ubuntu系统上将成功安装OpenCV。希望这可以帮到您!
阅读全文