• Ubuntu18源码编译OpenCV4.3


    Ubuntu18源码编译OpenCV4.3

    参考资料

    过程

    1. 首先更新包
    # Install the newest versions of all packages currently installed
    sudo apt-get -y upgrade
    # Handles changing dependencies with new versions of packages
    sudo apt-get -y dist-upgrade
    # Remove packages that are now no longer needed
    sudo apt-get -y autoremove
    
    1. 安装OpenCV所需依赖
    # Build tools:
    sudo apt-get install -y build-essential cmake
    
    # GUI (if you want to use GTK instead of Qt, replace 'qt5-default' with 'libgtkglext1-dev' and remove '-DWITH_QT=ON' option in CMake):
    sudo apt-get install -y 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 python-numpy python3-dev python3-tk python3-numpy
    
    # Java:
    sudo apt-get install -y ant default-jdk
    
    # Documentation:
    sudo apt-get install -y doxygen
    
    1. 安装过程
    mkdir build & cd build
    sudo cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D WITH_EIGEN=ON ..
    sudo make	# compile
    sudo make install	# install
    sudo ldconfig	# load config
    

    错误及解决

    make过程中报错,查资料后发现是虚拟机的虚拟内存过小,关机后重新调整即可。

    c++: internal compiler error: Killed (program cc1plus)
    
    1. 检查是否成功安装OpenCV库
      /samples/cpp/example_cmake下有个工程,编译后,如果成功运行并且显示"Hello OpenCV",则安装成功
      且在/usr/local/includes/下有opencv4的库

    最后还有个多版本的问题,查资料后,看到网上很多多版本并存的解决方案,先这样,有空再试。

  • 相关阅读:
    55 回文判断 (20分)
    AS3中 Event 类的target和currentTarget属性
    byteArray的深复制会造成类型丢失
    关于tink的碰撞检测类【3】
    去读代码
    debian安装nvidia驱动后命令行界面分辨率降低的问题
    1801A React
    TS入门
    项目实战【vue,react,微信小程序】(1710C)
    Go语言核心36讲11
  • 原文地址:https://www.cnblogs.com/vilogy/p/13855224.html
Copyright © 2020-2023  润新知