1

開いている cv で BREIF 記述子を使用しているときにエラーが発生しました。エラーは、BREIF がすべてのキー ポイントの記述子を提供できないことです。予想よりも少ない数のキーポイントの記述子を提供します.エラーは次のとおりです.エラーはbreif記述子のみを使用しています.SURFおよびSURF記述子を使用してもエラーはありません

OpenCV エラー: アサーションが失敗しました (masks[i].rows == queryDescriptorsCount && マスク[i].cols == trainDescCollection[i].rows && マスク[i].type() == CV_8UC1) チェックマスク、ファイル /home/ shashank/Desktop/opencv-2.4.5/modules/features2d/src/matchers.cpp、259 行目で、'cv::Exception' what() のインスタンスをスローした後に呼び出される: /home/shashank/Desktop/opencv-2.4. 5/modules/features2d/src/matchers.cpp:259: エラー: (-215) マスク[i].rows == queryDescriptorsCount && マスク[i].cols == trainDescCollection[i].rows && マスク[i]. type() == 関数 checkMasks の CV_8UC1

さらに
問い合わせると、前の画像のキーポイントの番号 957 次の画像のキーポイントの番号 910 breif 記述子のサイズ 32X880 が得られます。 breif 記述子 32X847 の 32X957 サイズである必要があります。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);
    }
4

1 に答える 1

3

OpenCV 実装では、Breif 記述子は、境界から近すぎるキーポイントを削除します。

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

解決策は、コード内のキーポイントをフィルタリングしてから記述子を抽出することです。

于 2015-03-03T16:41:18.273 に答える