Pregunta

I am developing an application which involves the use of Freak descriptors, just released in the OpenCV2.4.2 version.

In the documentation only two functions appear:

  • The class constructor

  • A confusing method selectPairs()

I want to use my own detector and then call the FREAK descriptor passing the keypoints detected but I don't understand clearly how the class works.

Question:

Do I strictly need to use selectPairs()? Is it enough just by calling FREAK.compute()? I don't really understand which is the use of selectPairs.

¿Fue útil?

Solución

Just flicked through the paper and saw in paragraph 4.2 that the authors set up a method to select the pairs of receptive fields to evaluate in their descriptor, as taking all possible pairs would be too much burden. The selectPairs() function let you recompute this set of pairs.

Read afterwards the documentation where they point exactly to this paragraph in the original article. Also, a few comments in the documentation tells you that there is an already available, offline learned set of pairs that is ready to use with the FREAK descriptor. So I guess at least for a start you could just use the precomputed pairs, and pass as an argument the list of KeyPoints that you obtained from your method to FREAK.compute.

If your results are disapointing, you could try the keypoint selection method used in the original paper (paragraph 2.1), then ultimately learning your own set of pairs.

Otros consejos

#include "iostream"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "cv.h"
#include "highgui.h"
#include <opencv2/nonfree/nonfree.hpp>
#include <opencv2/nonfree/features2d.hpp>
#include <opencv2/flann/flann.hpp>
#include <opencv2/legacy/legacy.hpp>
#include <vector>


using namespace cv;
using namespace std;

int main()
{
    Mat image1,image2;
    image1 = imread("C:\\lena.jpg",0);
    image2 = imread("C:\\lena1.bmp",0);

    vector<KeyPoint> keypointsA,keypointsB;
    Mat descriptorsA,descriptorsB;

    std::vector<DMatch> matches;

    OrbFeatureDetector detector(400);

    FREAK extractor;

    BruteForceMatcher<Hamming> matcher;

    detector.detect(image1,keypointsA);
    detector.detect(image2,keypointsB);

    extractor.compute(image1,keypointsA,descriptorsA);
    extractor.compute(image2,keypointsB,descriptorsB);

    matcher.match(descriptorsA, descriptorsB, matches);

    int nofmatches = 30;
    nth_element(matches.begin(),matches.begin()+nofmatches,matches.end());
    matches.erase(matches.begin()+nofmatches+1,matches.end());

    Mat imgMatch;
    drawMatches(image1, keypointsA, image2, keypointsB, matches, imgMatch);

    imshow("matches", imgMatch);
    waitKey(0);

    return 0;
}

this is a simple application to match points in two images...i have used Orb to detect keypoints and FREAK as descriptor on those keypoints...then brutforcematching to detect the corresponding points in two images...i have taken top 30 points that have best match...hope this helps you somewhat...

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top