RGBDSLAM 问题解决:create’ is not a member of ‘cv::FeatureDetector {aka cv::Feature2D}’ detecto

在学习高博士一起做RGBD-SLAM3时,遇到一些问题,现在记录下来:


1、detectFeatures.cpp:37:16: error: ‘create’ is not a member of ‘cv::FeatureDetector {aka cv::Feature2D}’
     detector = cv::FeatureDetector::create("ORB");

出现这个问题的主要原因是opencv版本不同,针对3.0以后的版本,特征提取器的声明方式有变化:

detector = cv::ORB::create();具体的参数可以源码查阅


2、detectFeatures.cpp.o:在函数‘main’中:
detectFeatures.cpp:(.text+0xfb1):对‘point2dTo3d(cv::Point3_&, CAMERA_INTRINSIC_PARAMETERS&)’未定义的引用

在CmakeLists文件里面添加对slambase的依赖;


ADD_EXECUTABLE( detectFeatures detectFeatures.cpp )
TARGET_LINK_LIBRARIES( detectFeatures 
slambase
${OpenCV_LIBS} 
    ${PCL_LIBRARIES} )


3、OpenCV Error: Assertion failed (confidence > 0 && confidence < 1) in run, file /home/limz/Cmake_module/opencv-3.2.0/modules/calib3d/src/ptsetreg.cpp, line 178
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/limz/Cmake_module/opencv-3.2.0/modules/calib3d/src/ptsetreg.cpp:178: error: (-215) confidence > 0 && confidence < 1 in function run


已放弃 (核心已转储)

同样是由于opencv版本不同,而出现的问题,3.0以后对solvePnPRansac函数的定义进行类修正:

bool solvePnPRansac(InputArray _opoints, InputArray _ipoints,
                        InputArray _cameraMatrix, InputArray _distCoeffs,
                        OutputArray _rvec, OutputArray _tvec, bool useExtrinsicGuess,
                        int iterationsCount, float reprojectionError, double confidence,
                        OutputArray _inliers, int flags)

增加了confidence:算法产生有用结果的置信系数

具体函数的学习可以参考这篇博客: 

opencv中solvePnPRansac函数求解相机位姿

你可能感兴趣的:(笔记,rgbdslam)