【问题标题】:Error with Breif , Brisk descriptor opencvBreif 错误,Brisk 描述符 opencv
【发布时间】:2015-02-17 10:14:30
【问题描述】:

在打开的简历中使用 BREIF 描述符时遇到错误。 错误在于 BREIF 无法为所有关键点提供描述符。它给出的关键点数量少于预期的描述符。我得到的错误如下。错误仅使用 breif 描述符。使用 SURF 和 SURF 描述符没有错误

OpenCV 错误:checkMasks 文件中的断言失败 (masks[i].rows == queryDescriptorsCount && mask[i].cols == trainDescCollection[i].rows && mask[i].type() == CV_8UC1) /home/shashank/Desktop/opencv-2.4.5/modules/features2d/src/matchers.cpp,第 259 行 在抛出 'cv::Exception' 的实例后调用终止 什么():/home/shashank/Desktop/opencv-2.4.5/modules/features2d/src/matchers.cpp:259:错误:(-215)掩码[i].rows == queryDescriptorsCount && 掩码[i]。 cols == trainDescCollection[i].rows && mask[i].type() == CV_8UC1 in function checkMasks

进一步询问我们得到
上一张图片中关键点的编号 957 下一个图像中的关键点编号 910 breif 描述符的大小 32X880。应该是 32X957 breif 描述符的大小 32X847。应该是 32X910 面具 [910 x 957]

代码如下

     cv::Ptr<FeatureDetector> detector=new GridAdaptedFeatureDetector(new SurfAdjuster(),keypt,noofbucketinwidth,noofbucketinlength);//surf


 //cv::Ptr<FeatureDetector> detector=new GridAdaptedFeatureDetector(new FastAdjuster(10,true),keypt,noofbucketinwidth,noofbucketinlength); //FAST

     detector->detect(img,keypointimage);
    cout<<"noof keypoint "<<keypointimage.size()<<endl;


    //for descriptor
    Mat descriptor;
     Ptr<DescriptorExtractor> extractdetector=DescriptorExtractor::create("SURF");
     Ptr<DescriptorExtractor> extractdetector=DescriptorExtractor::create("BRIEF");   
        extractdetector->compute( img, detectedpoint, descriptor);    

    //for matching
    if(FAST_H_prev.empty())
            FAST_H_prev = Mat::eye(3,3,CV_32FC1);

        std::vector<unsigned char> FAST_match_mask;

        if(!currentimagekeypoint.empty())
        {
            std::vector<cv::KeyPoint> test_kpts;
            warpKeypoints(FAST_H_prev.inv(), nextimagekeypoint, test_kpts);

           cv::Mat FAST_mask = windowedMatchingMask( test_kpts, currentimagekeypoint, 25, 25);
                matcher->match(Discriptorofnextimage,Discriptorofcurrentimage, FAST_matches, FAST_mask);
                      matches2points(currentimagekeypoint, nextimagekeypoint, FAST_matches, FAST_train_pts, FAST_query_pts);
            if(FAST_matches.size() > 5)
            {
                cv::Mat H = findHomography(FAST_train_pts, FAST_query_pts, RANSAC, 4, FAST_match_mask);
                if(countNonZero(Mat(FAST_match_mask)) > 15)
                    FAST_H_prev = H;
                else
                    FAST_H_prev = Mat::eye(3,3,CV_32FC1);
                               drawMatchesRelative(currentimagekeypoint, nextimagekeypoint, FAST_matches, currentimage, FAST_match_mask);

            }
        }
    else
    {
        FAST_H_prev = Mat::eye(3,3,CV_32FC1);
    }

【问题讨论】:

    标签: opencv computer-vision feature-detection feature-descriptor


    【解决方案1】:

    在 OpenCV 实现中,Breif 描述符会移除离边界太近的关键点。

    //Remove keypoints very close to the border
    KeyPointsFilter::runByImageBorder(keypoints, image.size(), PATCH_SIZE/2 + KERNEL_SIZE/2);
    

    一种解决方案可能是过滤代码中的关键点,然后提取描述符。

    【讨论】:

      猜你喜欢
      • 2014-07-02
      • 2014-10-09
      • 2010-10-27
      • 1970-01-01
      • 2016-02-10
      • 2018-06-28
      • 1970-01-01
      • 2017-03-21
      • 2014-07-15
      相关资源
      最近更新 更多