Problems encountered in "Together with RGB-D SLAM" (3)

**

Problems encountered in "Together with RGB-D SLAM" (3)

**
1.SIFI feature points, no nonfree.hpp module
Solution: download and install opencv-contrib corresponding to opencv, and see other people's tutorials that it is compiled at the same time as opencv, so first delete the previous opencv. There are many online tutorials deleted, so I won’t post them in detail here.
Opencv3.2+opencv_contrib3.2 installation reference: opencv3.2+opencv_contrib3.2
Note: The source code of Dr. Gao Xiang on github is updated to not require the use of SIFI feature points, and there is no need to install the opencv_contrib module. If you don't need it, you can choose not to install it, because there will be many errors during the installation process! It took me about a day~ to succeed, but I haven’t used it yet (because I didn’t see the update written by Gao Bo until later...).
2. According to the Gaobo tutorial, after the cmake project, make appears fatal error: slamBase.h no such file or directory There is no such file or directory
Solution: I made a very mentally retarded mistake! No wonder the Internet search can not find a solution. The slamBase.h file program is wrong. . . Specifically, it is PointCloud::Ptr image2PointCloud(cv::Mat& rgb,cv::Mat& depth,CAMERA_INTRINSIC_PARAMETERS& camera); there is a "&" marked as "$".
3. An error appears:'create' is not a member of'cv::FeatureDetector {aka cv::Feature2D}'
Solution: This is because Gaobo uses opencv2, and I use opencv3. I modified the original code as follows, and it runs smoothly.

cv::Ptr<cv::ORB> detector;   
    // 如果使用 sift, surf ,之前要初始化nonfree模块
    // cv::initModule_nonfree();
    // _detector = cv::FeatureDetector::create( "SIFT" );
    // _descriptor = cv::DescriptorExtractor::create( "SIFT" ); 
    detector = cv::ORB::create();
    vector< cv::KeyPoint > kp1, kp2; //关键点
    detector->detect( rgb1, kp1 );  //提取关键点
    detector->detect( rgb2, kp2 );
        
        // 计算描述子
    cv::Mat desp1, desp2;
    detector->compute( rgb1, kp1, desp1 );
    detector->compute( rgb2, kp2, desp2 );

4. Finally, when calculating the motion of the two images, another error occurred, opencv-3.2/modules/calib3d/src/ptsetreg.cpp:178: error: (-215) confidence> 0 && confidence <1 in function run .
Solution: Only need to change one place of the detectFeatures.cpp file to search online.

// 求解pnp
    cv::solvePnPRansac( pts_obj, pts_img, cameraMatrix, cv::Mat(), rvec, tvec, false, 100, 1.0, 0.99, inliers );

Finally, the operation was successful, and the pictures were not released, and they were all the same online. In short, if you encounter a bug, don't give up and stick to Google. My first note is over.
Attach opencv3.2 and the corresponding version of opencv_contrib download link opencv3.2 and opencv_contrib download

Guess you like

Origin blog.csdn.net/qq_43265072/article/details/104551816