open_vins 安装(ubuntu18.04 opencv3.2.0)
openvins官网
Getting Started ? Installation Guide (ROS1 and ROS2) | OpenVINS
Ubuntu 18.04 ROS 1 Melodic?(uses OpenCV 3.2)
这里他指的是ros1 melodic,他们用的opencv3.2测试过。
open_vins 官方给的组合Ubuntu 18.04 ROS 1 Melodic?(uses OpenCV 3.2)
Ubuntu 18.04 ??opencv 3.2.0 ??
我本机是3.4.8其实,别人的博客用的3.4.6,肯定是没限定,但是你得踩坑。
opencv默认没有aruco
SourceURL:file:///home/hqw/openvins.docx
openvins官网
Getting Started ? Installation Guide (ROS1 and ROS2) | OpenVINS
Ubuntu 18.04 ROS 1 Melodic?(uses OpenCV 3.2)
这里他指的是ros1 melodic,他们用的opencv3.2测试过。
open_vins 官方给的组合Ubuntu 18.04 ROS 1 Melodic?(uses OpenCV 3.2)
Ubuntu 18.04 ??opencv 3.2.0 ??
我本机是3.4.8其实,别人的博客用的3.4.6,肯定是没限定,但是你得踩坑。
opencv默认没有aruco
opencv参考命令
git clone https://github.com/opencv/opencv/git clone https://github.com/opencv/opencv_contrib/mkdir opencv/build/cd opencv/build/cmake -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules ..make -j8sudo make install
实际根据需求去git找的release,没用官方这个命令。
ubuntu18.04安装运行OpenVINS_openvins运行-CSDN博客
这个博客也是3.2
指定一个独立目录
$ cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local/opencv320 -D E
各种报错
可选错误——CUDA报错
CMake Error at cmake/OpenCVCompilerOptions.cmake:21 (else):
??A duplicate ELSE command was found inside an IF block.
Call Stack (most recent call first):
??CMakeLists.txt:495 (include)
这种问题很简单了,直接打开cmake/OpenCVCompilerOptions.cmake:21 ,找到21行,他就是多了一行多余的endif,直接删除掉就好了
# else() # message(STATUS "Looking for ccache - not found")
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_nppi_LIBRARY (ADVANCED)
因为本机安装过cuda
解决方法:
第一步:在 ?opencv-3.2.0/cmake ?文件夹下找到 ?FindCUDA.cmake 文件,对其进行修改
cd /home/zqzy/software/opencv-3.2.0/cmake
/home/hqw/hqw_opt/opencv/cmake/FindCUDA.cmake
sudo gedit FindCUDA.cmake
1)找到行
find_cuda_helper_libs(nppi)
改为
??find_cuda_helper_libs(nppial)
??find_cuda_helper_libs(nppicc)
??find_cuda_helper_libs(nppicom)
??find_cuda_helper_libs(nppidei)
??find_cuda_helper_libs(nppif)
??find_cuda_helper_libs(nppig)
??find_cuda_helper_libs(nppim)
??find_cuda_helper_libs(nppist)
??find_cuda_helper_libs(nppisu)
??find_cuda_helper_libs(nppitc)
上边那一对就是,但是需要把下边这个替换了?(-- CUDA detected: 11.4
)其实这一步我的版本不必(下边是5.5),按需操作
2)找到行
set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppi_LIBRARY};${CUDA_npps_LIBRARY}")
改为
set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppial_LIBRARY};${CUDA_nppicc_LIBRARY};${CUDA_nppicom_LIBRARY};${CUDA_nppidei_LIBRARY};${CUDA_nppif_LIBRARY};${CUDA_nppig_LIBRARY};${CUDA_nppim_LIBRARY};${CUDA_nppist_LIBRARY};${CUDA_nppisu_LIBRARY};${CUDA_nppitc_LIBRARY};${CUDA_npps_LIBRARY}")
3)找到行
unset(CUDA_nppi_LIBRARY CACHE)
改为
unset(CUDA_nppial_LIBRARY CACHE)
unset(CUDA_nppicc_LIBRARY CACHE)
unset(CUDA_nppicom_LIBRARY CACHE)
unset(CUDA_nppidei_LIBRARY CACHE)
unset(CUDA_nppif_LIBRARY CACHE)
unset(CUDA_nppig_LIBRARY CACHE)
unset(CUDA_nppim_LIBRARY CACHE)
unset(CUDA_nppist_LIBRARY CACHE)
unset(CUDA_nppisu_LIBRARY CACHE)
unset(CUDA_nppitc_LIBRARY CACHE)
第二步: ?在 ?opencv-3.2.0/cmake ?文件夹下找到文件 ?OpenCVDetectCUDA.cmake,对其进行修改
cd /home/zqzy/software/opencv-3.2.0/cmake
sudo gedit OpenCVDetectCUDA.cmake
??修改以下几行
?...
??set(__cuda_arch_ptx "")
??if(CUDA_GENERATION STREQUAL "Fermi")
????set(__cuda_arch_bin "2.0")
??elseif(CUDA_GENERATION STREQUAL "Kepler")
????set(__cuda_arch_bin "3.0 3.5 3.7")
??...
改为
??...
??set(__cuda_arch_ptx "")
??if(CUDA_GENERATION STREQUAL "Kepler")
????set(__cuda_arch_bin "3.0 3.5 3.7")
??elseif(CUDA_GENERATION STREQUAL "Maxwell")
????set(__cuda_arch_bin "5.0 5.2")
??...
第三步: Cuda9或者Cuda10及以后的版本 中有一个单独的halffloat(cuda_fp16.h)头文件,也应该被包括在opencv的目录里
将头文件cuda_fp16.h添加至 opencv/modules/cudev/include/opencv2/cudev/common.hpp
cd /home/zqzy/software/opencv-3.2.0/modules/cudev/include/opencv2/cudev
sudo gedit common.hpp
即在common.hpp中添加
#include <cuda_fp16.h>
重新生成即可
最后都试了,不行,不知道本机环境什么情况,毕竟不是我新装的机器,docker、cuda、ros、opencv
不带cuda
$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/opencv320 ?-DWITH_CUDA=OFF ??..
undefined reference to `cblas_sgemm
缺库
sudo apt-get install libopenblas-dev
$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/opencv320 ?-DWITH_CUDA=OFF ?-DCMAKE_EXE_LINKER_FLAGS=-lcblas ??..
make?-j8
sudo?make?install
$ ls /usr/local/opencv320/
bin ?include ?lib ?share
Release 3.2.0 · opencv/opencv_contrib · GitHub
忘了带contrib和aruco,删除/usr/local/opencv320,重装
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/opencv320 ?-DWITH_CUDA=OFF ?-DCMAKE_EXE_LINKER_FLAGS=-lcblas -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.2.0 ??..
opencv编译不过
fatal error: linux/videodev.h: No such file or directory
sudo?apt-get?install?libv4l-dev sudo?ln?-s /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h
fatal error: sys/videoio.h: No such file or directory
其实是/modules/没写进去
$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/opencv320 ?-DWITH_CUDA=OFF ?-DCMAKE_EXE_LINKER_FLAGS=-lcblas -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.2.0/modules/ ??..
-- Configuring done
-- Generating done
-- Build files have been written to: /home/hqw/hqw_opt/opencv-3.2.0/build
配置成功
编译失败
?fatal error: LAPACKE_H_PATH-NOTFOUND/lapacke.h: No such file or directory #include “LAPACKE_H_PATH-NOTFOUND/lapacke.h”
sudo apt-get install liblapacke-dev checkinstall
修改出现问题的文件,例如我的文件是opencv-3.2.0/build/opencv_lapack.h
将第二行中的#include"LAPACKE_H_PATH-NOTFOUND/lapacke.h"?修改为#include"lapacke.h"即可
报错
fatal error: unsupported/Eigen/MatrixFunctions: No such file or directory
首先确保Eigen已经安装了,然后找到Eigen所在的路径。我的在/usr/include/eigen3这里
然后将报错的文件中的下面句子
include <unsupported/Eigen/MatrixFunctions>
改成
include </usr/include/eigen3/unsupported/Eigen/MatrixFunctions>
// #include <unsupported/Eigen/MatrixFunctions>
#include?</usr/include/eigen3/unsupported/Eigen/MatrixFunctions>
编译成功
安装
看到openvins引用新编译的opencv库,新的是3.2.0,默认是3.4.8,虽然我没替换3.4.8,制定了/usr/local/opencv320/,但是执行了make install。。。。
被install以后被自动找到直接就编译成功了,如果找不到就改一下cmakelists.txt
opencv参考命令
git clone https://github.com/opencv/opencv/git clone https://github.com/opencv/opencv_contrib/mkdir opencv/build/cd opencv/build/cmake -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules ..make -j8sudo make install
实际根据需求去git找的release,没用官方这个命令。
ubuntu18.04安装运行OpenVINS_openvins运行-CSDN博客
这个博客也是3.2
指定一个独立目录
$ cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local/opencv320 -D E
各种报错
CMake Error at cmake/OpenCVCompilerOptions.cmake:21 (else):
??A duplicate ELSE command was found inside an IF block.
Call Stack (most recent call first):
??CMakeLists.txt:495 (include)
这种问题很简单了,直接打开cmake/OpenCVCompilerOptions.cmake:21 ,找到21行,他就是多了一行多余的endif,直接删除掉就好了
# else() # message(STATUS "Looking for ccache - not found")
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_nppi_LIBRARY (ADVANCED)
因为本机安装过cuda
解决方法:
第一步:在 ?opencv-3.2.0/cmake ?文件夹下找到 ?FindCUDA.cmake 文件,对其进行修改
cd /home/zqzy/software/opencv-3.2.0/cmake
/home/hqw/hqw_opt/opencv/cmake/FindCUDA.cmake
sudo gedit FindCUDA.cmake
1)找到行
find_cuda_helper_libs(nppi)
改为
??find_cuda_helper_libs(nppial)
??find_cuda_helper_libs(nppicc)
??find_cuda_helper_libs(nppicom)
??find_cuda_helper_libs(nppidei)
??find_cuda_helper_libs(nppif)
??find_cuda_helper_libs(nppig)
??find_cuda_helper_libs(nppim)
??find_cuda_helper_libs(nppist)
??find_cuda_helper_libs(nppisu)
??find_cuda_helper_libs(nppitc)
上边那一对就是,但是需要把下边这个替换了?(-- CUDA detected: 11.4
)其实这一步我的版本不必(下边是5.5),按需操作
2)找到行
set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppi_LIBRARY};${CUDA_npps_LIBRARY}")
改为
set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppial_LIBRARY};${CUDA_nppicc_LIBRARY};${CUDA_nppicom_LIBRARY};${CUDA_nppidei_LIBRARY};${CUDA_nppif_LIBRARY};${CUDA_nppig_LIBRARY};${CUDA_nppim_LIBRARY};${CUDA_nppist_LIBRARY};${CUDA_nppisu_LIBRARY};${CUDA_nppitc_LIBRARY};${CUDA_npps_LIBRARY}")
3)找到行
unset(CUDA_nppi_LIBRARY CACHE)
改为
unset(CUDA_nppial_LIBRARY CACHE)
unset(CUDA_nppicc_LIBRARY CACHE)
unset(CUDA_nppicom_LIBRARY CACHE)
unset(CUDA_nppidei_LIBRARY CACHE)
unset(CUDA_nppif_LIBRARY CACHE)
unset(CUDA_nppig_LIBRARY CACHE)
unset(CUDA_nppim_LIBRARY CACHE)
unset(CUDA_nppist_LIBRARY CACHE)
unset(CUDA_nppisu_LIBRARY CACHE)
unset(CUDA_nppitc_LIBRARY CACHE)
第二步: ?在 ?opencv-3.2.0/cmake ?文件夹下找到文件 ?OpenCVDetectCUDA.cmake,对其进行修改
cd /home/zqzy/software/opencv-3.2.0/cmake
sudo gedit OpenCVDetectCUDA.cmake
??修改以下几行
?...
??set(__cuda_arch_ptx "")
??if(CUDA_GENERATION STREQUAL "Fermi")
????set(__cuda_arch_bin "2.0")
??elseif(CUDA_GENERATION STREQUAL "Kepler")
????set(__cuda_arch_bin "3.0 3.5 3.7")
??...
改为
??...
??set(__cuda_arch_ptx "")
??if(CUDA_GENERATION STREQUAL "Kepler")
????set(__cuda_arch_bin "3.0 3.5 3.7")
??elseif(CUDA_GENERATION STREQUAL "Maxwell")
????set(__cuda_arch_bin "5.0 5.2")
??...
第三步: Cuda9或者Cuda10及以后的版本 中有一个单独的halffloat(cuda_fp16.h)头文件,也应该被包括在opencv的目录里
将头文件cuda_fp16.h添加至 opencv/modules/cudev/include/opencv2/cudev/common.hpp
cd /home/zqzy/software/opencv-3.2.0/modules/cudev/include/opencv2/cudev
sudo gedit common.hpp
即在common.hpp中添加
#include <cuda_fp16.h>
重新生成即可
最后都试了,不行,不知道本机环境什么情况,毕竟不是我新装的机器,docker、cuda、ros、opencv
不带cuda
$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/opencv320 ?-DWITH_CUDA=OFF ??..
undefined reference to `cblas_sgemm
缺库
sudo apt-get install libopenblas-dev
$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/opencv320 ?-DWITH_CUDA=OFF ?-DCMAKE_EXE_LINKER_FLAGS=-lcblas ??..
make?-j8
sudo?make?install
$ ls /usr/local/opencv320/
bin ?include ?lib ?share
Release 3.2.0 · opencv/opencv_contrib · GitHub
忘了带contrib和aruco,删除/usr/local/opencv320,重装
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/opencv320 ?-DWITH_CUDA=OFF ?-DCMAKE_EXE_LINKER_FLAGS=-lcblas -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.2.0 ??..
opencv编译不过
fatal error: linux/videodev.h: No such file or directory
sudo?apt-get?install?libv4l-dev sudo?ln?-s /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h
fatal error: sys/videoio.h: No such file or directory
其实是/modules/没写进去
$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/opencv320 ?-DWITH_CUDA=OFF ?-DCMAKE_EXE_LINKER_FLAGS=-lcblas -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.2.0/modules/ ??..
-- Configuring done
-- Generating done
-- Build files have been written to: /home/hqw/hqw_opt/opencv-3.2.0/build
配置成功
编译失败
?fatal error: LAPACKE_H_PATH-NOTFOUND/lapacke.h: No such file or directory #include “LAPACKE_H_PATH-NOTFOUND/lapacke.h”
sudo apt-get install liblapacke-dev checkinstall
修改出现问题的文件,例如我的文件是opencv-3.2.0/build/opencv_lapack.h
将第二行中的#include"LAPACKE_H_PATH-NOTFOUND/lapacke.h"?修改为#include"lapacke.h"即可
报错
fatal error: unsupported/Eigen/MatrixFunctions: No such file or directory
首先确保Eigen已经安装了,然后找到Eigen所在的路径。我的在/usr/include/eigen3这里
然后将报错的文件中的下面句子
include <unsupported/Eigen/MatrixFunctions>
改成
include </usr/include/eigen3/unsupported/Eigen/MatrixFunctions>
// #include <unsupported/Eigen/MatrixFunctions>
#include?</usr/include/eigen3/unsupported/Eigen/MatrixFunctions>
安装
openvins引用新编译的opencv库
被install以后被自动找到,如果找不到就改一下cmakelists.txt
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!