OpenCV DescriptorMatcher matches
I'm trying to match a query image against a set of images following the example 'matching_to_many_images' (from here: https://code.ros.org/trac/opencv/browser/branches/2.3/opencv/samples/cpp/matching_to_many_images.cpp). Now, the example works fine, my question is about the matches that are returned. If I got it right matches always correspond to query descriptors (i.e number of matches always equal number of query descriptors). What if I would like to do it the other way around; return matches corresponding to training descriptors (i.e number of matches equal number of training descriptors) instead, is this possible?
Imagine the following problem: I'm matching image Q against a set of 1000 images. Between image Q and image 40 there are 100 matches. I make a copy of image 40, making image 40 and 41 identical, and the dataset 1001 images. Now if I repeat the matching the results will be 50 matches between Q and 40, and 50 between Q and 41. Not 100 matches for both 40 and 41, which is what I would like to achieve. Does anyone have any idea how to do this?
One "quick-and-dirty" solution is to treat the dataset as query and vice versa, but then you cant make use of indexes etc so it's not a sufficient one.