OpenCV filtering ORB matches

后端 未结 3 1543
醉梦人生
醉梦人生 2020-12-09 00:10

I am using the ORB feature detector to find matches between two images using this code:

    FeatureDetector detector = FeatureDetector.create(FeatureDetector         


        
相关标签:
3条回答
  • 2020-12-09 00:21

    Matching is done by taking the shortest Hamming distance between two descriptors. So you will always get a match between the detected features.

    You should modify the threshold of your ORB detector. This way, you will reduce the likelihood of detecting features from the background (i.e. noise), so the majority of your detected features would come from the subject of interest.

    0 讨论(0)
  • 2020-12-09 00:24

    To get better matching results you should include these filtering methods in the given order.

    1. Perform matching in two directions i.e for each point in first image find the best match in second image and vice versa .

    2. Perform ratio test(ratio test of euclidean distances) between matches to eliminate ambiguous matches .

    3. Perform RANSAC test: it's a model fitting algorithm which finds the best data which fits the model and removes outliers.
    4. Perform homography: it is an image projection algorithm.

    You can get all the details of above methods in chapter 9 of Computer vision application programming cookbook. It also has sample code for implementing these filtering techniques. It is very easy to understand. (Note: The code in this book is in C++ but once you understand, it can be easily implemented in JAVA too)

    0 讨论(0)
  • 2020-12-09 00:28

    After reading Rober Langaniere book. I came to know there is a way. It is to remove matches with the further distances. In java, it is as following

    Collections.sort(bestMatches,new Comparator<DMatch>() {
            @Override
            public int compare(DMatch o1, DMatch o2) {
                if(o1.distance<o2.distance)
                    return -1;
                if(o1.distance>o2.distance)
                    return 1;
                return 0;
            }
        });
        if(bestMatches.size()>3){
            bestMatches = bestMatches.subList(0,3);
        }
    
    0 讨论(0)
提交回复
热议问题