title: Training of SVM classifier in OpenCV using SIFT and ORB features
body: <p>I'm trying to train a SVM classifier to recognize pedestrians in a set of 64x128 images. I've already done that using HOG features, and now I need to implement the same thing using SIFT and ORB. For HOG features, I had always the same number of features (3780), so that the matrix for the train was image_number by 3780. Now, using SIFT extractor I get keypoints of different sizes. How can I create a matrix for the classifier using these keypoints of different sizes? </p>
  
  <p>Many thanks for your help!</p>
  
  <p>I solved the descriptors' issue putting all of them in the same row. However, I found out that most of desriptors have a 0 value, so the classifier doesn't work well. Do you know how can I solve this problem?</p>
  
  <p>This is a piece of the code:</p>
  
  <pre><code>DenseFeatureDetector detector;
  SiftDescriptorExtractor descriptor;
  vector&lt;KeyPoint&gt; keypoints;
  
  
  //for every image I compute te SIFT
  detector.detect(image, keypoints);
  Mat desc;
  descriptor.compute(image,keypoints, desc);
  Mat v(1,30976,CV_32FC1);
      for (int j = 0; j&lt;desc.rows; j++){
          for(int k = 0; k&lt;desc.cols; k++){
              v.at&lt;float&gt;(0,128*j+k) = desc.at&lt;float&gt;(j,k);
  
          }
      } //now in vector v there are all the descriptors (the problem is that most of them have 0 value)
  
  descriptormat.push_back(v);  //descriptormat is the cv::Mat that I use to train the SVM
  </code></pre>