相关疑难解决方法(0)

OpenCV findFundamentalMat非常不稳定和敏感

我正在为我的大学制作一个项目,我们希望Quadrcopter能够用他的相机稳定自己.不幸的是,基本矩阵对特征点内的微小变化反应非常敏感,我稍后会给你举例.

我认为,由于ocv,我的匹配功能已经很好了.我正在使用SURF功能并将它们与knn-Method匹配:

    SurfFeatureDetector surf_detect;
    surf_detect = SurfFeatureDetector(400);

    //detect keypoints
    surf_detect.detect(fr_one.img, fr_one.kp);
    surf_detect.detect(fr_two.img, fr_two.kp);

    //extract keypoints
    SurfDescriptorExtractor surf_extract;
    surf_extract.compute(fr_one.img, fr_one.kp, fr_one.descriptors);
    surf_extract.compute(fr_two.img, fr_two.kp, fr_two.descriptors);

    //match keypoints
    vector<vector<DMatch> > matches1,matches2;
    vector<DMatch> symMatches,goodMatches;
    FlannBasedMatcher flann_match;

    flann_match.knnMatch(fr_one.descriptors, fr_two.descriptors, matches1,2);
    flann_match.knnMatch(fr_two.descriptors, fr_one.descriptors, matches2,2);

    //test matches in both ways
    symmetryTest(matches1,matches2,symMatches);

    std::vector<cv::Point2f> points1, points2;
    for (std::vector<cv::DMatch>::const_iterator it= symMatches.begin();
       it!= symMatches.end(); ++it)
    {
        //left keypoints
        float x= fr_one.kp[it->queryIdx].pt.x;
        float y= fr_one.kp[it->queryIdx].pt.y;
        points1.push_back(cv::Point2f(x,y));
        //right keypoints
        x = fr_two.kp[it->trainIdx].pt.x;
        y = fr_two.kp[it->trainIdx].pt.y;
        points2.push_back(cv::Point2f(x,y));
    }

    //kill outliers with ransac
    vector<uchar> inliers(points1.size(),0); …
Run Code Online (Sandbox Code Playgroud)

c++ opencv

5
推荐指数
2
解决办法
9541
查看次数

标签 统计

c++ ×1

opencv ×1