在學習高博士一起做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_<float>&, 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 178terminate 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:算法產生有用結果的置信系數
具體函數的學習可以參考這篇博客:
新聞熱點
疑難解答