Ask Your Question

Revision history [back]

One to Many Images by ID


I am seeking to use 2D features to match a large amount of images.

The opencv example of one to many images

So all this does is find that all query features were matched to the training set. How to get the id? DMatch does not contain information about the particular image it is from.

    descriptorMatcher->match( queryDescriptors, matches );
    double matchTime = tm.getTimeMilli();

    CV_Assert( queryDescriptors.rows == (int)matches.size() || matches.empty() );

I have also looked at FLANN index, but i do not understand it well enough. First create a BOW vocabulary from the features in all training images.

While looping
    Mat bowFeature = getBow2(inImg, detector, bow, featureMask2);

Ptr<cv::flann::Index> index = train_index(trainData);

int K = 2;
cv::Mat dists, indices;
index->knnSearch(bowTest, indices, dists, K);
float response =<int>(0, 0)

This should give me the image id right?

I am unsure about how the index is generated.

Are there any samples of one to many image matching by id?