title: OpenCV Multiple marker detection?
body: <p>I've been working on detecting fiducial markers in scenes. An example of my fiducial marker is here: 
  <a href="http://tinypic.com/view.php?pic=4r6k3q&amp;s=8#.VNgsgzVVK1F" rel="nofollow">http://tinypic.com/view.php?pic=4r6k3q&amp;s=8#.VNgsgzVVK1F</a></p>
  
  <p>I have been able to detect a single fiducial marker in a scene very well. What is the methodology for detecting multiple fiducial markers in a scene? Doing feature detection, extraction, and then matching is great for finding a single match, but it seems to be the wrong method for detecting multiple matches since it would be difficult to determine which features belong to which marker? </p>
  
  <p>The fiducial markers would be the same, and would not be in a known location in the scene.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Below is some sample code. I was trying to match the first fiducial marker with <strong><em>x</em></strong> number of keypoints, and then use the remaining keypoints to match the second marker. However, this is not robust at all. Does anybody have any suggestions?</p>
  
  <pre><code>OrbFeatureDetector detector;
  vector&lt;KeyPoint&gt; keypoints1, keypoints2; 
  
  detector.detect(im1, keypoints1);
  detector.detect(im2, keypoints2);
  
  Mat display_im1, display_im2;
  drawKeypoints(im1, keypoints1, display_im1, Scalar(0,0,255));
  drawKeypoints(im2, keypoints2, display_im2, Scalar(0,0,255));
  
  SiftDescriptorExtractor extractor;
  
  Mat descriptors1, descriptors2;
  
  extractor.compute( im1, keypoints1, descriptors1 );
  extractor.compute( im2, keypoints2, descriptors2 );
  
  BFMatcher matcher;
  vector&lt; DMatch &gt; matches1, matches2;
  matcher.match( descriptors1, descriptors2, matches1 );
  sort (matches1.begin(), matches1.end());
  matches2 = matches;
  int numElementsToSave = 50;
  
  matches1.erase(matches1.begin()+numElementsToSave,matches1.end());
  matches2.erase(matches2.begin(),matches2.begin()+numElementsToSave);
  
  Mat match_im1, match_im2;
  drawMatches( im1, keypoints1, im2, keypoints2,
      matches1, match_im1, Scalar::all(-1), Scalar::all(-1),
      vector&lt;char&gt;(), DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS );
  
  drawMatches( im1, keypoints1, im2, keypoints2,
      matches2, match_im2, Scalar::all(-1), Scalar::all(-1),
      vector&lt;char&gt;(), DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS );
  </code></pre>