我已经下载了20170817-tinker-board-linaro-stretch-alip-v2.0.1.img为Tinker。我正在尝试安装OpenCV 3.0.0。我遵循了这里的说明:http://www.pyimagesearch.com/2015/06/22/install-opencv-3-0-and-python-2-7-on-ubuntu/。
我无法安装libjasper-dev。因此,我没有安装libpng12-dev,而是安装了libpng。
从昨天早上开始,我正在尝试在Tinker上编译OpenCV。但在构建过程中出现了以下错误:
/usr/include/c++/6/cmath:106:11: error: ::acos has not been declared
其次是所有的数学公式都会触发类似的错误。
OpenCV的哪个Debian版本是稳定的?我应该安装较低版本的OpenCV吗?有人能帮忙吗?
发布于 2017-09-02 18:23:00
我成功地在一个OpenCV上安装了TinkerBoard。步骤如下:
20170817-tinker-board-linaro-stretch-alip-v2.0.1.img的修补板从这里。sudo dd if=/path/to/your/imgfile of=/path/to/your/memorycard bs=4M
在这方面已经有了很多帮助。
sudo dpkg-reconfigure tzdata重置系统时间。Debian图像修补板已经安装了ntp。等待几分钟后,修补板调整板的时间从网络。步骤如下:
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo apt-get -y autoremove在安装perl应用程序时,您可能会遇到以下警告消息:
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").虽然这并不影响您的OpenCV安装,但在花了3天时间在修补板上编译Opencv之后,我不想留下任何机会。
使用以下方法可以抑制这些警告消息:
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是不可用的,因此我已经从上面的媒体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'发布于 2017-12-17 13:33:17
几天后,我终于有了很好的安排。我的帖子改进了以前的答案。
步骤类似于我之前的情况,但我改变了几个字符串,因为我有不同的错误。
在我的例子中,我安装了新的Asus Tinker板:
第一次开始修补板。
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade有必要删除默认(旧的) OpenCV:
sudo apt-get remove libopencv*
sudo apt-get -y autoremove
# INSTALL THE DEPENDENCIES
# Build tools:
sudo apt-get install -y build-essential cmake
# GUI (I had errors with Qt, so I did next)
sudo apt-get install -y libgtkglext1-dev libvtk6-dev
# Media I/O:
sudo apt-get install -y zlib1g-dev libjpeg-dev libwebp-dev libpng-dev libtiff5-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 libxine-dev
sudo apt-get install -y gstreamer1.0-plugins-*
# 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。
cd ~
wget -O opencv.zip https://github.com/opencv/opencv/archive/3.3.0.zip
unzip opencv.zip
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/3.3.0.zip
unzip opencv_contrib.zip编译和安装OpenCV
cd ~/opencv-3.3.0/
mkdir build
cd build
cmake -DWITH_OPENGL=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON -DWITH_FFMPEG=0 -DWITH_XINE=ON -DBUILD_EXAMPLES=ON -DOPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.3.0/modules -DENABLE_PRECOMPILED_HEADERS=OFF ..CMake应该开始构建您的配置,几分钟后您将看到:
-- Configuring done
-- Generating done
-- Build files have been written to: ./opencv-3.3.0/build如果无法看到生成已完成,则会出现一些问题。读取要调查的错误消息和错误日志文件。
我没有举例,但你可以试试。Qt我删除了。
make没有-j4更好。
sudo make install
sudo ldconfig测试安装
linaro@tinkerboard:~$ python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'3.3.0'发布于 2018-03-05 15:57:03
安装ffmpeg (前面的答案跳过此) sudo apt更新&& sudo apt安装ffmpeg libav-tools x264 x265
我还建议在编译opncv文件时安装额外的软件包,并启用neon和vfpv3。这将显著提高性能:https://www.pyimagesearch.com/2017/10/09/optimizing-opencv-on-the-raspberry-pi/
https://stackoverflow.com/questions/46001399
复制相似问题