zoukankan      html  css  js  c++  java
  • 树莓派中编译OpenCV3.4.1和OpenCvSharp

    一、简介

      本文重点描述在树莓派中编译OpenCV3.4.1和OpenCvSharp,大家都知道OpenCVSharp是使用C#调用OpenCV最简洁的一个库。但是在Linux上或者树莓派上运行时,需要编译对应的Linux和CPU架构的版本。

    二、编译过程

    #树莓派3b安装OPENCV3.4.1
    apt-get install -y build-essential cmake 
    libgtkglext1-dev libvtk6-dev 
    zlib1g-dev libjpeg-dev libwebp-dev libpng-dev libtiff5-dev libopenexr-dev libgdal-dev && 
    add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main" && apt update && apt install libjasper1 libjasper-dev && 
    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 
    libtbb-dev libeigen3-dev 
    python-dev python-tk python-numpy python3-dev python3-tk python3-numpy
    
    OPENCV_VERSION=3.4.1
    wget  ${OPENCV_VERSION}.zip && unzip ${OPENCV_VERSION}.zip && rm ${OPENCV_VERSION}.zip && mv opencv-${OPENCV_VERSION} OpenCV
    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
    
    #下列命令执行时,注意检测OPENCV_EXTRA_MODULES_PATH设置的路径为刚刚解压的OpenCV_contrib路径。
    
    apt-get install libhdf5-dev
    apt-get install libtiff5-dev
    apt-get install libtiffxx0c2
    
    cd OpenCV && mkdir build && cd build && 
    cmake 
    -D OPENCV_EXTRA_MODULES_PATH=/usr/local/opencv/OpenCV_contrib/modules 
    -D CMAKE_BUILD_TYPE=RELEASE 
    -D BUILD_EXAMPLES=OFF 
    -D BUILD_DOCS=OFF 
    -D BUILD_PERF_TESTS=OFF 
    -D BUILD_TESTS=OFF 
    -D BUILD_opencv_java=OFF 
    -D BUILD_opencv_python=OFF 
    .. && make -j4 && make install && ldconfig
    
    
    # Download OpenCvSharp
    OPENCVSHARP_VERSION=3.4.1.20180605
    git clone https://github.com/shimat/opencvsharp.git
    cd opencvsharp && git fetch --all --tags --prune && git checkout ${OPENCVSHARP_VERSION}
    mkdir /opencvsharp/make
    cd /usr/local/opencv/OpenCvSharp/opencvsharp/make && cmake -D CMAKE_INSTALL_PREFIX=/usr/local/opencv/OpenCvSharp/opencvsharp/make /usr/local/opencv/OpenCvSharp/opencvsharp/src && make -j 4 && make install

    三、效果

  • 相关阅读:
    Android数据存储之File
    Openfiler使用说明
    nginx的upstream目前支持5种方式的分配
    centOS 6.5关闭防火墙步骤
    yum下载文件的存放位置
    ubuntu如何开启root,如何启用Ubuntu中root帐号
    ubuntu下的apt-get内网本地源的搭建
    [转]StarWind模拟iSCSI设备
    ORACLE删除某用户下所有对象
    [转]oracle导入提示“IMP-00010:不是有效的导出文件,头部验证失败”的解决方案
  • 原文地址:https://www.cnblogs.com/songxingzhu/p/9688378.html
Copyright © 2011-2022 走看看