首页 > 系统相关 >opencv ubuntu安装

opencv ubuntu安装

时间:2023-09-26 18:12:59浏览次数:44  
标签:opencv sudo dev OPENCV apt ubuntu get 安装

######################################
# INSTALL OPENCV ON UBUNTU OR DEBIAN #
######################################

# -------------------------------------------------------------------- |
#                       SCRIPT OPTIONS                                 |
# ---------------------------------------------------------------------|
OPENCV_VERSION='3.4.2'       # Version to be installed
OPENCV_CONTRIB='NO'          # Install OpenCV's extra modules (YES/NO)
# -------------------------------------------------------------------- |

# |          THIS SCRIPT IS TESTED CORRECTLY ON          |
# |------------------------------------------------------|
# | OS               | OpenCV       | Test | Last test   |
# |------------------|--------------|------|-------------|
# | Debian 10.2      | OpenCV 4.2.0 | OK   | 26 Dec 2019 |
# |----------------------------------------------------- |
# | Debian 10.1      | OpenCV 4.1.1 | OK   | 28 Sep 2019 |
# |----------------------------------------------------- |
# | Ubuntu 18.04 LTS | OpenCV 4.1.0 | OK   | 22 Jun 2019 |
# | Debian 9.9       | OpenCV 4.1.0 | OK   | 22 Jun 2019 |
# |----------------------------------------------------- |
# | Ubuntu 18.04 LTS | OpenCV 3.4.2 | OK   | 18 Jul 2018 |
# | Debian 9.5       | OpenCV 3.4.2 | OK   | 18 Jul 2018 |



# 1. KEEP UBUNTU OR DEBIAN UP TO DATE

sudo apt-get -y update
# sudo apt-get -y upgrade       # Uncomment to install new versions of packages currently installed
# sudo apt-get -y dist-upgrade  # Uncomment to handle changing dependencies with new vers. of pack.
# sudo apt-get -y autoremove    # Uncomment to remove packages that are now no longer needed


# 2. INSTALL THE DEPENDENCIES

# Build tools:
sudo apt-get install -y build-essential cmake

# GUI (if you want GTK, change 'qt5-default' to 'libgtkglext1-dev' and remove '-DWITH_QT=ON'):
sudo apt-get install -y libgtk2.0-dev pkg-config qt5-default libvtk6-dev

# Media I/O:
sudo apt-get install -y zlib1g-dev libjpeg-dev libwebp-dev libpng-dev libtiff5-dev libjasper-dev \
                        libopenexr-dev libgdal-dev

# Video I/O:
sudo apt-get install -y libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev \
                        libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev yasm \
                        libopencore-amrnb-dev libopencore-amrwb-dev libv4l-dev libxine2-dev

# Parallelism and linear algebra libraries:
sudo apt-get install -y libtbb-dev libeigen3-dev

# Python:
sudo apt-get install -y python-dev  python-tk  pylint  python-numpy  \
                        python3-dev python3-tk pylint3 python3-numpy flake8

# Java:
sudo apt-get install -y ant default-jdk

# Documentation and other:
sudo apt-get install -y doxygen unzip wget


# 3. INSTALL THE LIBRARY

wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip
unzip ${OPENCV_VERSION}.zip # && rm ${OPENCV_VERSION}.zip
mv opencv-${OPENCV_VERSION} OpenCV

if [ $OPENCV_CONTRIB = 'YES' ]; then
  wget https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip
  unzip ${OPENCV_VERSION}.zip && rm ${OPENCV_VERSION}.zip
  mv opencv_contrib-${OPENCV_VERSION} opencv_contrib
  mv opencv_contrib OpenCV
fi

cd OpenCV && mkdir build && cd build

if [ $OPENCV_CONTRIB = 'NO' ]; then
cmake -D CMAKE_BUILD_TYPE=Release -D OPENCV_GENERATE_PKGCONFIG=ON -D WITH_GTK=ON \
      -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_V4L=ON -D WITH_VTK=ON \
      -D WITH_TBB=ON -D CMAKE_INSTALL_PREFIX=/usr/local ..
fi

if [ $OPENCV_CONTRIB = 'YES' ]; then
cmake -DWITH_QT=ON -DWITH_OPENGL=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON \
      -DWITH_XINE=ON -DENABLE_PRECOMPILED_HEADERS=OFF \
      -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules ..
fi

sudo make -j8
sudo make install
sudo ldconfig


# 4. EXECUTE SOME OPENCV EXAMPLES AND COMPILE A DEMONSTRATION

# To complete this step, please visit 'http://milq.github.io/install-opencv-ubuntu-debian'.



标签:opencv,sudo,dev,OPENCV,apt,ubuntu,get,安装
From: https://www.cnblogs.com/yunhgu/p/17730857.html

相关文章

  • Ubuntu22.04远程桌面配置(RDP,VNC)
    Ubuntu22.04设置远程桌面可以通过Gnome42内置的远程功能或,手动安装RDP或VNC软件一、通过Gnome42内置的远程功能在UbuntuDesktop22.04LTS上,远程桌面服务被配置为用户服务。因此,您必须登录系统才能启动远程桌面服务。如果您想在无人值守模式下远程使用Ubuntu(无需将显示器、......
  • windows环境安装make命令
    windows环境安装make命令弩哥++于2023-05-1517:50:00发布3067收藏7文章标签:windows版权一、Make简介Make是一种流行的构建工具,常用于将源代码转换成可执行文件或者其他形式的输出文件(如库文件、文档等)。Make可以自动化地执行编译、链接等一系列操作,提高开发效率。Ma......
  • 【Hyperledger Fabric】Fabric 2.2 手动安装
    本文内容介绍在Centos7.9系统下手动安装v2.2版本Fabric的过程。相关过程配置可参考fabric-samples截至2023.09,HyperLedgerFabric最新长期支持版本是v2.5,其次是v2.2和v1.4。下一待发行版本是v3.0,v3.0将提供了基于SmartBFT共识库的BFT排序服务,是继v1.4版本之后(v2.x版本仅提供......
  • helm安装mongodb带密码
    https://www.cnblogs.com/wuyubing/p/17576508.html 利用helm查看各种官方标准复杂的yaml配置以供参考#以查看rabbitmq集群安装的配置举例#首先添加chart仓库helmrepoaddaliyun-apphubhttps://apphub.aliyuncs.comhelmrepoupdate#这里我们在后面加上--dry-run--de......
  • docker-compose安装Redis
    一、单机版本1、docker-composeversion:'3'services:redis:image:redis:5.0restart:alwaysprivileged:truecontainer_name:redis-javaports:-6379:6379volumes:-/var/docker/server/redis/redis.conf:/etc/redis......
  • 创建在建安装包
    创建在建安装包新建模板小书匠在线安装包会获取仓库描述(Updates.xml),与存在包中的描述文件进行对比。创那一个库repository,并将其传至web服务器。然后在生成安装包的config.xml中指定升级仓库的路径。创建仓库在package路径中,使用repogen工具为所有的包创建在线仓库:repogen.......
  • 瑞芯微RK3568|SDK开发之环境安装及编译操作
    1. SDK简介一个通用 Linux SDK 工程目录包含有buildroot、app、kernel、device、docs、external 等目录。其中一些特性芯片如RK3308/RV1108/RV1109/RV1126等,会有所不同。● app:存放上层应用 app,主要是 qcamera/qfm/qplayer/settings 等一些应用程序。● buildroot:基......
  • java集成openCV
    官网:https://github.com/opencv/opencv/releases1、下载:opencv-4.8.0-windows.exe2、安装.exe文件3、将安装目录下的D:\XXX\opencv\build\java\opencv-480.jar添加至java项目工程中4、将对对应jdk位数的opencv_java480.dll动态库复制到path环境变量下的任意目录,方便程序中加载......
  • jupyter安装与使用
    1、检查python版本python-Vpip-V2、设置pip源pipconfigsetglobal.index-urlhttps://mirrors.aliyun.com/pypi/simple/pipconfiglist#非https源,须加信任pipconfigsetinstall.trusted-hostxxx.com3、安装&启动jupterlab pipinstalljupyterlabju......
  • 在CentOS系统中安装Nginx
    以下是在CentOS系统中安装Nginx的步骤:1.更新系统软件包:sudoyumupdate2.安装EPEL存储库: sudoyuminstallepel-release3.安装Nginx:sudoyuminstallnginx4.启动Nginx服务:sudosystemctlstartnginx5.设置Nginx服务自启动:sudosystemctlenablenginx6.验证Nginx......