2016.07.07
在做一起做RGB-D SLAM (6)编译g2o的地方报错:
CMakeFiles/slamEnd.dir/slamEnd.cpp.o: In function `g2o::LinearSolverCSparse<Eigen::Matrix<double, 6, 6, 0, 6, 6> >::solve(g2o::SparseBlockMatrix<Eigen::Matrix<double, 6, 6, 0, 6, 6> > const&, double*, double*)':
/opt/ros/indigo/include/g2o/solvers/csparse/linear_solver_csparse.h:126: undefined reference to `g2o::csparse_extension::cs_cholsolsymb(cs_di_sparse const*, double*, cs_di_symbolic const*, double*, int*)'
/opt/ros/indigo/include/g2o/solvers/csparse/linear_solver_csparse.h:130: undefined reference to `g2o::csparse_extension::writeCs2Octave(char const*, cs_di_sparse const*, bool)'
CMakeFiles/slamEnd.dir/slamEnd.cpp.o: In function `g2o::LinearSolverCSparse<Eigen::Matrix<double, 6, 6, 0, 6, 6> >::solveBlocks(double**&, g2o::SparseBlockMatrix<Eigen::Matrix<double, 6, 6, 0, 6, 6> > const&)':
/opt/ros/indigo/include/g2o/solvers/csparse/linear_solver_csparse.h:171: undefined reference to `g2o::csparse_extension::cs_chol_workspace(cs_di_sparse const*, cs_di_symbolic const*, int*, double*)'
CMakeFiles/slamEnd.dir/slamEnd.cpp.o: In function `g2o::LinearSolverCSparse<Eigen::Matrix<double, 6, 6, 0, 6, 6> >::solvePattern(g2o::SparseBlockMatrix<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > const&, g2o::SparseBlockMatrix<Eigen::Matrix<double, 6, 6, 0, 6, 6> > const&)':
/opt/ros/indigo/include/g2o/solvers/csparse/linear_solver_csparse.h:208: undefined reference to `g2o::csparse_extension::cs_chol_workspace(cs_di_sparse const*, cs_di_symbolic const*, int*, double*)'
大概的意思就是undefined reference to `g2o::csparse extension::,拿出Google神器,搜到一位大神解读:https://github.com/tum-vision/dvo_slam/issues/2,说在你安装g2o之前并没有安装libsuitesparse-dev,如果你现在执行
sudo apt-get install libsuitesparse-dev
后发现已经安装好了,这时候有可能它是在你安装好g2o之后今天之前装好的,所以进入g2o安装包重新编译安装,再编译RGB-D SLAM的程序就ok了。
2016.07.07
在做一起做RGB-D SLAM (5)http://www.cnblogs.com/gaoxiang12/p/4719156.html时遇到一个错误:
undefined reference to `cv::initModule_nonfree()’意思是initModule_nonfree没被定义。没找到原因,搜索到了校友的博客:http://blog.csdn.net/zyh821351004/article/details/47322823,意思是这个模块并没有安装好,安装方法如下:
sudo add-apt-repository --yes ppa:xqms/opencv-nonfree
sudo apt-get update
sudo apt-get install libopencv-nonfree-dev
然后再编译程序就好了。
2016.06.29
自己写了个opencv读写图片的程序,工程demo按照高翔一起做RGBD(2)里构建的,自己在源文件里添加了几行简单的opencv读写图片程序,有如下报错:
CMakeFiles/main.dir/main.cpp.o: In function `cv::Mat::~Mat()':
main.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x69): undefined reference to `cv::Mat::deallocate()'
main.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x54): undefined reference to `cv::fastFree(void*)'
CMakeFiles/main.dir/main.cpp.o: In function `main':
main.cpp:(.text.startup+0xdf): undefined reference to `cv::imread(std::string const&, int)'
main.cpp:(.text.startup+0x176): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
main.cpp:(.text.startup+0x1db): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
main.cpp:(.text.startup+0x201): undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)'
main.cpp:(.text.startup+0x21b): undefined reference to `cv::waitKey(int)'
main.cpp:(.text.startup+0x284): undefined reference to `cv::Mat::deallocate()'
分析原因后发现至添加源文件代码但是并没有添加相应的依赖项,于是把源文件同级的CMakeLists.txt改为:
FIND_PACKAGE( OpenCV REQUIRED )
add_executable( main main.cpp )
TARGET_LINK_LIBRARIES( main ${OpenCV_LIBS} )
注意,顺序不能错
2016.06.12
‘ORB_SLAM-master’ depends on non-existent package ‘opencv2’
google:take out all opencv dependencies from the package.xml…. that does the trick. Since ROS Hyrdo, opencv is included in core
solved:remove in manifest.xml in package
2016.06.13
ORB_SLAM :cmake+make successfully but when open CmakeLists.txt with Qt error: include could not find load file:
/core/rosbuild/rosbuild.cmake CmakeLists.txt line2
open CmakeLists.txt in line2 we find that it should be error with
$ENV{ROS_ROOT}:
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
so we write as:
include(/opt/ros/indigo/share/core/rosbuild/rosbuild.cmake)
2016.06.27
编译深入理解OpenCV SfM程序时:
(1):’SURF_GPU’ : is not a member of ‘cv::gpu’ Google发现 SURF_GPU是在/opencv2/nonfree/gpu.hpp里面的,所以在GPUSURFFeatureMatcher.h添加
#include <opencv2/nonfree/gpu.hpp>
即可
(2): Math/v3d_linear.h: No such file or directory
Google发现未安装SSBA Library,SSBA下载后cmake+make没问题,但是就是还不会把这个库路径让cmake找到,最后实在解决不了第三方库的问题就把调用他的地方换成绝对路径了。#include
或者:在CMakeLists.txt里面
set(SSBA_LIBRARY_DIR “${CMAKE_SOURCE_DIR}/SSBA-3.0/build” CACHE PATH “Directory to find SSBA libs”) 改为:
set(SSBA_LIBRARY_DIR “/home/kylefan/program/mastering_opencv/Chapter4_StructureFromMotion/SSBA-3.0/build” CACHE PATH “Directory to find SSBA libs”)
(3):‘BruteForceMatcher_GPU’ was not declared in this scope,因为刚才把gpu库改了,所以把原来的gpu.h加上:
#include <opencv2/nonfree/gpu.hpp>
#include <opencv2/gpu/gpu.hpp>
(4):‘toROSMsg’ is not a member of ‘pcl’
Google了一下:在Visualization.cpp里加入:
#include <pcl/ros/conversions.h>
编译通过!
其实上面很多问题都是由于opencv版本问题导致,由于电脑里安装的是2.4.13,而git官网写明支持2.4.2-2.4.11,好多问题都是自己不好好看官网说明导致的!