One to Many Images by ID
Hello,
I am seeking to use 2D features to match a large amount of images.
The opencv example of one to many images
https://github.com/opencv/opencv/blob...
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 );
tm.stop();
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);
trainData.push_back(bowFeature.reshape(1,1));
Ptr<cv::flann::Index> index = train_index(trainData);
int K = 2;
cv::Mat dists, indices;
index->knnSearch(bowTest, indices, dists, K);
float response = indices.at<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?
what are you trying to achieve ?
if you have "ids", it sounds more than classification(which? use flann::Index) than matching(where? use Matcher)
(the matching_to_many example assumes, all train images show the same thing, just from a different pose)
@berak - Given a list of images. I wish to identify the name of a new sample image which matches only one from the list of images.
go for the bow / flann::Index idea, then.