title: cvExtractSURF don't work when useProvidedKeypoints = true
body: <p>So, I'm trying to extract some SURF keypoints, but I want to impose these key points! So, I put the last parameter to "true" which is "useProvidedKeypoints".</p>
  
  <p>Also, when I create my Keypoint, I used the default constructor (so some default values there). I only change the point "pt" and the octave that I set to 3.</p>
  
  <p>I'm using the C++ interface with SURF. But I know that the problem is right at cvExtractSURF because I copied that part of the code in mine to help me debug.</p>
  
  <p>When I call that function, with the last parameter set to true, I got this error:</p>
  
  <pre><code>OpenCV Error: Bad argument (Unknown array type) in cvarrToMat, file /home/widgg/opencv/trunk/modules/core/src/matrix.cpp, line 651
  terminate called after throwing an instance of 'cv::Exception'
    what():  /home/widgg/opencv/trunk/modules/core/src/matrix.cpp:651: error: (-5) Unknown array type in function cvarrToMat
  </code></pre>
  
  <p>I really don't know what I'm doing wrong!</p>
  
  <p>EDIT:</p>
  
  <p>Here's some code. First how I create the keypoints (I left a couple of informations, like the layer_id stuff, but you get the main idea):</p>
  
  <pre><code>for (json_pt_info_vector::iterator b_beg = beg-&gt;points.begin(); b_beg != b_end; ++b_beg)
  {
    int layer_id = b_beg-&gt;layer_id;
    json_point_info_coord &amp;jpic = b_beg-&gt;coord;
  
    jpic.feature_id = features[layer_id].keypoints.size();
    KeyPoint kp;
    kp.octave = 3;
    kp.pt.x = jpic.x;
    kp.pt.y = jpic.y;
    features[layer_id].keypoints.push_back(kp);
  }
  </code></pre>
  
  <p>Here's the call to SURF:</p>
  
  <pre><code>SURF surf(300, 3, 4);
  for (int i = 0; i &lt; nb_img; ++i)
  {
    debug_msg("extract_features #4.1");
    cv::detail::ImageFeatures &amp;cdif = features[i];
    Mat gray_image = imread(param.layer_images[i], 0);  // 0 = force to gray scale!
  
    debug_msg("extract_features #4.2");
    vector&lt;float&gt; descriptors;
    debug_msg("extract_features #4.3");
    surf(gray_image, Mat(), cdif.keypoints, descriptors, true); // MUST BE TRUE TO FORCE THE PROVIDED KEYPOINTS
  
    debug_msg("extract_features #4.4");
    cdif.descriptors = Mat(descriptors, true).reshape(1, (int)cdif.keypoints.size());
    debug_msg("extract_features #4.5");
    gray_image.release();
  
    debug_msg("extract_features #4.6");
    images[i] = imread(param.layer_images[i]);  // keep the image open
  }
  </code></pre>
  
  <p>It crashes after #4.3 in the debug message!</p>
  
  <p>Hope that helps!</p>
  
  <p>EDIT 2:</p>
  
  <p>I replaced some part by cv::SurfDescriptorExtracter. I replace everything from 4.3 to 4.5 with the following line:</p>
  
  <pre><code> extractor.compute(gray_image, cdif.keypoints, cdif.descriptors);
  </code></pre>
  
  <p>So now, there's still a bug, but it's located somewhere else, not necessary related to this question!</p>