title: OpenCV brief descriptors less than keypoints
body: <p>I'm using OpenCV to detect features and compute descriptors. </p>
  
  <p>For feature detection I'm using FAST:</p>
  
  <pre><code>cv::Ptr&lt;cv::FeatureDetector&gt; _detector = cv::FastFeatureDetector::create(_configuration.threshold,
                                              _configuration.nonmaxSuppression);
  </code></pre>
  
  <p>For descriptors I'm using BRIEF:</p>
  
  <pre><code>cv::Ptr&lt;cv::DescriptorExtractor&gt; _descriptor_extractor = cv::xfeatures2d::BriefDescriptorExtractor::create();
  </code></pre>
  
  <p>After that, I'd like to order keypoints based on their response and store just a certain number of them:</p>
  
  <pre><code>typedef std::map&lt;float,cv::KeyPoint,std::greater&lt;float&gt; &gt; ResponseKeypointMap;
  
  // keypoint buffer
  std::vector&lt;cv::KeyPoint&gt; keypoints;
  cv::Mat descriptors;
  
  // detect keypoints
  _detector-&gt;detect(rgb_image_, keypoints);
  
  const int keypoints_size = keypoints.size();
  if(!keypoints_size){
      std::cerr &lt;&lt; "warning: [PointDetector] found 0 keypoints!\n";
      return;
  }
  
  ResponseKeypointMap keypoints_map;
  for(int i=0; i &lt; keypoints_size; ++i){
    keypoints_map.insert(std::make_pair(keypoints[i].response,keypoints[i]));
  }
  
  int iterations = std::min(_configuration.max_keypoints_size,keypoints_size);
  std::vector&lt;cv::KeyPoint&gt; filtered_keypoints;
  filtered_keypoints.resize(iterations);
  int k=0;
  
  for(ResponseKeypointMap::iterator it = keypoints_map.begin();
      it != keypoints_map.end();
      ++it){
    filtered_keypoints[k] = it-&gt;second;
    k++;
  
    if(k&gt;=iterations)
      break;
  }
  
  std::cerr &lt;&lt; "filtered keypoints size: " &lt;&lt; filtered_keypoints.size() &lt;&lt; std::endl;
  
  _descriptor_extractor-&gt;compute(rgb_image_, filtered_keypoints, descriptors);
  std::cerr &lt;&lt; "Computed " &lt;&lt; descriptors.rows &lt;&lt; "x" &lt;&lt; descriptors.cols &lt;&lt; " descriptors" &lt;&lt; std::endl;
  </code></pre>
  
  <p>I don't know why I'm giving 100 keypoints to the DescriptorExtractor, but I'm recieving 55 descriptors.</p>
  
  <p>I'd be very grateful if you could explain me what is happening.</p>
  
  <p>Thanks.</p>