一:undefined reference to `cv::
解决办法:链接opencv,pcl库
二:undefined reference to point2dTo3d
解决办法:添加 libslambase.a(截图截错了, libslambase.a前面注释应该去掉)
三:error: ‘KeyPoint’ is not a member of ‘cv’ vector
解决办法:在slambase.h添加三个头文件
#include
#include
#include
四:undefined reference to `pcl::visualization::CloudViewer::wasStopped(int)'
解决办法:将/src/CMakeList.txt中FIND_PACKAGE( PCL REQUIRED COMPONENTS common io )改为
FIND_PACKAGE( PCL REQUIRED COMPONENTS common io visualization )
五:打开点云,只看到红绿蓝三个方块
解决办法:按R重置视角。刚才你是站在原点盯着坐标轴看呢。
如果点云没有颜色,请按5显示颜色。
六:‘transformPointCloud’ is not a member of ‘pcl’
添加头文件:
// 各种头文件
// C++标准库
#include
#include
#include
七:‘cv2eigen’ is not a member of ‘cv’ cv::cv2eigen(R, r);
将slambase.cpp中
cv::cv2eigen(R, r);
改为:
for ( int i=0; i<3; i++ )
for ( int j=0; j<3; j++ )
r(i,j) = R.at(i,j);
八: undefined reference to `pcl::VoxelGrid
改CMakeLists.txt:
# 增加PCL库的依赖
FIND_PACKAGE( PCL REQUIRED COMPONENTS common io visualization filters )
九:getDefaultCamera’ was not declared in this scope
在slambase.h中添加:
// cvMat2Eigen
Eigen::Isometry3d cvMat2Eigen( cv::Mat& rvec, cv::Mat& tvec );
// joinPointCloud
PointCloud::Ptr joinPointCloud( PointCloud::Ptr original, FRAME& newFrame, Eigen::Isometry3d T, CAMERA_INTRINSIC_PARAMETERS& camera ) ;
inline static CAMERA_INTRINSIC_PARAMETERS getDefaultCamera()
{
ParameterReader pd;
CAMERA_INTRINSIC_PARAMETERS camera;
camera.fx = atof( pd.getData( "camera.fx" ).c_str());
camera.fy = atof( pd.getData( "camera.fy" ).c_str());
camera.cx = atof( pd.getData( "camera.cx" ).c_str());
camera.cy = atof( pd.getData( "camera.cy" ).c_str());
camera.scale = atof( pd.getData( "camera.scale" ).c_str() );
return camera;
}
十:第一帧就出现OpenCV Error: Assertion failed (opoints.isContinuous()) in solvePnPRansac
解决办法:将data所在路径改成绝对路径如下图
但是还是会在某一帧出现这个错误,因为data中有两张完全一样的图片,应该就是高博士所说的在下一节要解决的goodmatch=0的问题。等待下一节的学习
十一:遇到c++11不兼容的问题,出现一堆参数not scope,还有 error: ‘struct FRAME’ has no member named ‘’之类一堆错误
原因是下载的g2o版本最新的,需要卸载掉新版本的,重新安装一个老版本的
卸载:
sudo rm -r /usr/local/lib/libg2o* /usr/local/include/g2o /usr/local/lib/g2o /usr/local/bin/g2o*
安装:
下载地址:点击打开链接
然后进入g2o文件夹执行:
mkdir build
cd build
cmake ..
make
sudo make install
就OK了