在Tinker Board中安装OpenCV [英] Installing OpenCV in Tinker Board

查看:238
本文介绍了在Tinker Board中安装OpenCV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为Tinker Board下载了20170817-tinker-board-linaro-stretch-alip-v2.0.1.img.我正在尝试安装OpenCV 3.0.0.我已按照此处给出的说明进行操作: http://www.pyimagesearch.com/2015/06/22/install-opencv-3-0-and-python-2-7-on-ubuntu/.

我无法安装libjasper-dev.因此,我安装了libpng而不是libpng12-dev.

自昨天早上以来,我一直在尝试在Tinker Board上编译OpenCV.但是在构建过程中出现以下错误:

/usr/include/c++/6/cmath:106:11: error: ::acos has not been declared

所有数学公式之后都会触发类似的错误.

哪个Debian版本对OpenCV稳定?我应该安装较低版本的OpenCV吗?有人可以帮忙吗?

解决方案

我成功地设法在TinkerBoard上安装了OpenCV.步骤如下:

  1. 将16 GB的存储卡格式化为FAT32
  2. 在打开电源之前,请确保您已将修补板通过lan电缆连接到Internet.

  3. 开机后,用sudo dpkg-reconfigure tzdata重置系统时间.修补板的Debian映像已经安装了ntp.等待几分钟,等待修补板调整网络中的板时间.

  4. 要安装opencv及其依赖库,我已按照

    尽管这不会影响您的OpenCV安装,但是在尝试在修补板上编译Opencv花费了3天之后,我不想留下任何机会.

    使用以下内容禁止显示这些警告消息:

    export LANGUAGE=en_US.UTF-8
    export LANG=en_US.UTF-8
    export LC_ALL=en_US.UTF-8
    dpkg-reconfigure locales
    

    感谢此帖子.

    # INSTALL THE DEPENDENCIES
    
    # 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):  I just went with qt5 itself.
    
    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 libopenexr-dev libgdal-dev
    

    请注意libjasper-dev在该版本的Debian中不可用,因此我已从上面的Media I/O列表中删除.

    # 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
    
    sudo apt-get install -y gstreamer1.0-plugins-*
    sudo apt-get install libxine-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
    
    sudo apt-get install python-pip
    
    # Java:
    sudo apt-get install -y ant default-jdk
    
    # Documentation:
    sudo apt-get install -y doxygen
    

    获取OpenCV.我决定使用3.0.0版,因为我的开发是在此版本中进行的.您可以选择其他版本.

    sudo apt-get install -y unzip wget
    wget https://github.com/opencv/opencv/archive/3.0.0.zip
    unzip 3.0.0.zip
    rm 3.0.0.zip
    

    构建OpenCV.

    mv opencv-3.0.0 OpenCV
    cd OpenCV
    mkdir build
    cd build
    
    cmake -DWITH_QT=ON -DWITH_OPENGL=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON -DWITH_FFMPEG=0 -DWITH_XINE=ON -DBUILD_EXAMPLES=ON -DENABLE_PRECOMPILED_HEADERS=OFF ..
    

    与原始脚本相比,这里有一个变化-添加了-DWITH_FFMPEG=0,因为缺少FFMPEG库,我也不介意安装它.您可能想要这样做.

    make
    

    尽管TinkerBoard支持make -j4,但我选择在make上放慢速度.使用make进行的编译花费了将近2.5个小时,并且在c ++代码中出现了许多看似缩进的错误,但是最终编译结束了.

    sudo make install
    sudo ldconfig
    
    $ python
    >>> import cv2
    >>> cv2.__version__
    '3.0.0'
    

    I have downloaded 20170817-tinker-board-linaro-stretch-alip-v2.0.1.img for Tinker Board. I am trying to install OpenCV 3.0.0. I have followed the instructions given here : http://www.pyimagesearch.com/2015/06/22/install-opencv-3-0-and-python-2-7-on-ubuntu/.

    I was not able to install libjasper-dev. Hence, instead of libpng12-dev, I have installed libpng.

    I am trying to compile OpenCV on Tinker Board since yesterday morning. But have been getting following errors during building process:

    /usr/include/c++/6/cmath:106:11: error: ::acos has not been declared

    Followed by all the math formula triggers similar errors.

    Which Debian version is stable for OpenCV? Should I install a lower version of OpenCV? Can someone help?

    解决方案

    I successfully managed to install OpenCV on a TinkerBoard. The following were the steps:

    1. Format a 16 GB memory card to FAT32
    2. Download debian image 20170817-tinker-board-linaro-stretch-alip-v2.0.1.img for tinker board from here.

    3. Copy the img file on to the memory card

    sudo dd if=/path/to/your/imgfile of=/path/to/your/memorycard bs=4M

    a lot of help on this is already available in SO.

    1. Before powering on ensure that you connect your tinker board to the internet through a lan cable.

    2. Once powered on reset the system time with sudo dpkg-reconfigure tzdata. Debian image for tinker board already has ntp installed. Wait a couple of minutes for the tinker board to adjust the board time from the network.

    3. To install opencv and its dependant library, I have taken the instructions given here ....though I had to make some custom library installations but it was very helpful. Please note, my purpose of using Opencv on Tinker Board is to process live video's and hence my focus was more towards installing appropriate video codecs.

    The following were the steps:

    sudo apt-get -y update
    sudo apt-get -y upgrade
    sudo apt-get -y dist-upgrade
    sudo apt-get -y autoremove
    

    You may face the following warning messages during installation of perl applications:

    perl: warning: Setting locale failed.
    
    perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_US.utf8"
        are supported and installed on your system.
    perl: warning: Falling back to the standard locale ("C").
    

    Though this doesn't impact your installation of OpenCV, after spending 3 days in trying to compile Opencv on tinker board I do not want to leave anything for a chance.

    Use the following to suppress these warning messages:

    export LANGUAGE=en_US.UTF-8
    export LANG=en_US.UTF-8
    export LC_ALL=en_US.UTF-8
    dpkg-reconfigure locales
    

    Thanks to this post.

    # INSTALL THE DEPENDENCIES
    
    # 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):  I just went with qt5 itself.
    
    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 libopenexr-dev libgdal-dev
    

    Pls note libjasper-dev is unavailable for this version of Debian and hence I have removed from the above Media I/O list.

    # 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
    
    sudo apt-get install -y gstreamer1.0-plugins-*
    sudo apt-get install libxine-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
    
    sudo apt-get install python-pip
    
    # Java:
    sudo apt-get install -y ant default-jdk
    
    # Documentation:
    sudo apt-get install -y doxygen
    

    Get OpenCV. I decided to go with version 3.0.0 as my development was in this version. You may choose a different version.

    sudo apt-get install -y unzip wget
    wget https://github.com/opencv/opencv/archive/3.0.0.zip
    unzip 3.0.0.zip
    rm 3.0.0.zip
    

    Build OpenCV.

    mv opencv-3.0.0 OpenCV
    cd OpenCV
    mkdir build
    cd build
    
    cmake -DWITH_QT=ON -DWITH_OPENGL=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON -DWITH_FFMPEG=0 -DWITH_XINE=ON -DBUILD_EXAMPLES=ON -DENABLE_PRECOMPILED_HEADERS=OFF ..
    

    A change here from the original script - is the addition of -DWITH_FFMPEG=0, as FFMPEG library was missing and I was not in a frame of mind to install the same. You may want to do so.

    make
    

    Though TinkerBoard supports make -j4 i chose to go slow with make. The compile with make took almost 2.5 hours with lot of seemingly indentation errors in c++ codes but finally the compile gets over.

    sudo make install
    sudo ldconfig
    
    $ python
    >>> import cv2
    >>> cv2.__version__
    '3.0.0'
    

    这篇关于在Tinker Board中安装OpenCV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆