title: openCV Android: knnMatcher returns only matches for 1 descriptor
body: <p>I have to implement a logo detection algoritm for android for my masterthesis.
  I'm currently using the openCV android library with NDK and have already managed to detect keypoints and setup descriptors for these keypoints using SURF.</p>
  
  <p>Next step for me is to find 2 nearest matches for every keypoint using <strong>knnMatch</strong>, afterwards i'm throwing away the matches where the best knn match isn't very distinguishable compared with the second (the distance ration of these two is too low)
  here's a part of my code:</p>
  
  <pre><code>private static List&lt;DMatch&gt; knn(Mat queryDescriptors, Mat trainDescriptors) {
      List&lt;List&lt;DMatch&gt;&gt; matches = new ArrayList&lt;List&lt;DMatch&gt;&gt;();
      List&lt;DMatch&gt; retMatches = new ArrayList&lt;DMatch&gt;();
      DescriptorMatcher matcher = DescriptorMatcher
              .create(DescriptorMatcher.BRUTEFORCE);
      matcher.knnMatch(queryDescriptors, trainDescriptors, matches, 2);
  </code></pre>
  
  <p>My problem here is that when I have for example 500 descriptors for the query logo and 400 for the train logo, knn returns 500 matches, but <strong>every single one</strong> is for one and the same keypoint. Normally, it returns the 2 best matches for every descriptor, so 500 different descriptors, now they return 500 times the best matches for one and the same descriptor.</p>
  
  <p><strong>So when i draw these knn matches, there is 1 match line, drawn 500 times, between always the same keypoints</strong></p>
  
  <p>When I try the simple matcher, who simply returns the best match, I get more lines.
  I've tested this with comparing an image to itself. Knn return this one line, where a simple match draws all 500 matches, who are in this case ofcourse correct.</p>
  
  <p>I can't find any posts where this similar issue has been treated, does any one had this problem or knows what i'm doing wrong here?</p>
  
  <p>Thanx in advance.</p>