title: Can't match two SIFT descriptors with OpenCV
body: <p>I'm trying to match two <code>SIFT</code> descriptors with the simplest code I could've think of but the <code>OpenCV 3</code> keeps throwing exceptions.</p>
  
  <p>This is my code:</p>
  
  <pre><code>cv::Mat img1 = imread(...); // Shortened for the example
  cv::Mat img2 = imread(...); // Shortened for the example
  
  std::vector&lt;KeyPoint&gt; keypoints1, keypoints2;
  Ptr&lt;SIFT&gt; ptrSift = SIFT::create(200, 3, 0.07, 15);
  Mat descriptors1, descriptors2;
  ptrSift-&gt;detectAndCompute(img1, Mat(), keypoints1, descriptors1, false);
  ptrSift-&gt;detectAndCompute(img2, Mat(), keypoints2, descriptors2, false);
  </code></pre>
  
  <p>The code above brings me good results which I can visualize with the <code>drawKeypoints</code> function.</p>
  
  <p>Then I use the following code to match the descriptors:</p>
  
  <pre><code>BFMatcher matcher;
  std::vector&lt; DMatch &gt; matches;
  matcher.match(descriptors1, descriptors2, matches);
  </code></pre>
  
  <p>But it keeps throwing:</p>
  
  <blockquote>
    <p>C:\builds\master_PackSlave-win32-vc12-shared\opencv\modules\features2d\src\matchers.cpp:722:
    error: (-215) _queryDescriptors.type() == trainDescType in function
    cv::BFMatcher::knnMatchImpl</p>
    
    <p>OpenCV Error: Assertion failed (type == src2.type() &amp;&amp; src1.cols ==
    src2.cols &amp;&amp; (type == CV_32F || type == CV_8U)) in cv::batchDistance,
    file C:\buil
    ds\master_PackSlave-win32-vc12-shared\opencv\modules\core\src\stat.cpp,
    line 3608 Exception:
    C:\builds\master_PackSlave-win32-vc12-shared\opencv\modules\core\src\stat.cpp:3608:
    error: (-215) type == src2.type() &amp;&amp; src1.cols == src2. cols &amp;&amp; (type
    == CV_32F || type == CV_8U) in function cv::batchDistance</p>
  </blockquote>
  
  <p>Thanks</p>