标签:make 记录 linu 功能 orm desc avformat nat off
前言
博主想要TX2上使用opencv中的viz模块,需要安装opencv_contrib,目前TX2的opencv版本是刷机的时候安装的opencv3.3.1,需要先卸载,再安装。
步骤
1. 卸载TX2刷机的opencv版本;
sudo apt-get purge libopencv* sudo apt autoremove sudo apt-get update
2. 安装带有viz模块的opencv3.3.1版本;
2.1. 安装opencv的依赖库,必须在安装opencv之前安装好;
[compiler] sudo apt-get install build-essential [required] sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev [optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
viz模块
sudo apt-get install libvtk5-dev
2.2. 下载源码并解压,包括opencv-3.3.1和opencv_contrib-3.3.1,从github下载,注意两者的版本必须要一致;
/opt$ sudo unzip opencv-3.3.1.zip opencv_contrib-3.3.1.zip /opt$cd opencv-3.3.1 /opt/opencv-3.3.1$sudo mv ../opencv_contrib-3.3.1 ./ /opt/opencv-3.3.1$sudo mkdir build /opt/opencv-3.3.1$cd build
2.3. 编译安装;
/opt/opencv-3.3.1/build$ sudo cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib-3.3.1/modules/ -D WITH_VTK=ON .. /opt/opencv-3.3.1/build$sudo make -j8(wait long time) /opt/opencv-3.3.1/build$sudo make install
其中,
-D WITH_VTK=ON
是关于viz模块的;
问题:cmake的时候正常,make的时候出错,显著性的错误如下:
xfeatures2d/boostdesc: Download failed: 7;"Couldn‘t connect to server"
and
/opt/opencv-3.3.1/modules/stitching/include/opencv2/stitching/detail/matchers.hpp:52:42: fatal error: opencv2/xfeatures2d/cuda.hpp: No such file or directory compilation terminated.
step1:
Github上有网友指出是因为OpenCVDownload.cmake
在日志记录功能中出现问题,找到文件~/opencv-3.3.1/cmake/OpenCVDownload.cmake,
将以下代码
macro(ocv_download_log) file(APPEND "${OPENCV_DOWNLOAD_LOG}" "${ARGN}\n") endmacro()
修改成
function(ocv_download_log) file(APPEND "${OPENCV_DOWNLOAD_LOG}" "${ARGN}\n") endfunction()
step2:
cmake命令添加以下内容:
cmake -D BUILD_opencv_xfeatures2d=OFF
还有说HTTP的安装需要某个版本的cmake(博主没有进行这个问题的操作,具体可参考github的issue),其他的原因有可能是内存空间不足等。
make这一步骤完成,build目录占了差不多11G的空间。
3. 测试opencv和viz模块;
test_code:
参考
1. Jetson TX2 卸载并安装OpenCV3.4.0;
2. linux系统卸载opencv;
3. linux系统opencv以及opencv_contrib的安装与使用;
4. opencv_installation_on_linux;
完
标签:make 记录 linu 功能 orm desc avformat nat off
原文地址:https://www.cnblogs.com/happyamyhope/p/12504538.html