Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Question about FlannBasedMatcher

Hi,

I am trying to train a set of patterns and find a match within a test image.

That being said, I have many descriptors from train data set:

cv::Mat descriptor1;
cv::Mat descriptor2;
cv::Mat descriptor3;
cv::Mat descriptor4;
cv::Mat descriptor5;

//put all train set descriptors in a vector
std::vector<cv::Mat> descriptors;
descriptors.push_back(descriptor1); ... descriptors.push_back(descriptor5);

//add and train
FlannBasedMatcher matcher;
matcher.add(descriptors);
matcher.train();

//match
cv::Mat descriptorTest;
matcher.knnMatch(descriptorTest, m_knnMatches, 2);

//ratio test to get good matches
std::vector<cv::DMatch> matches = ratioTest(m_knnMatches);

// the result matches after ratio test contains many DMatch for example:
DMatch (queryIdx: *, trainIdx: *, imageIdx: 1, distance: *.**}
DMatch (queryIdx: *, trainIdx: *, imageIdx: 2, distance: *.**}
DMatch (queryIdx: *, trainIdx: *, imageIdx: 0, distance: *.**}
DMatch (queryIdx: *, trainIdx: *, imageIdx: 1, distance: *.**}
DMatch (queryIdx: *, trainIdx: *, imageIdx: 4, distance: *.**}

As you can see, the DMatch objects in the vector are from different trained image - different imageIdx.

As the accuracy is still not very good, I want to try Homography estimation but I don't know how to do it with that kinds of result matches. Only Homography example I have is working on 1 train image and 1 test image. Can you give me some advices for implementing Homography estimation in this situation?

What else can you think of to improve accuracy as post processes?