title: cv::SVM response one class for every sample
body: <p>I am new in Match faces , I am trying to learn how to use SVM with HOG descriptors.
  I wrote a simple face recognizer with SVM, but when i activate it , code always returns 1</p>
  
  <pre><code>float *getHOG(const cv::Mat &amp;image, int* count)//Compute HOG
  {
      cv::HOGDescriptor hog;
      std::vector&lt;float&gt; res;
      cv::Mat img2;
      cv::resize(image, img2, cv::Size(64, 128));
      hog.compute(img2, res, cv::Size(8, 8), cv::Size(0, 0));
      *count = res.size();
      float* result = new float[*count];
      for(int i = 0; i &lt; res.size(); i++)
      {
          result[i] = res[i];
      }
      return result;
  }
  
  const int dataSetLength = 10;
  float **getTraininigData(int* setlen, int* veclen)//Load some samples of data
  {
      char *names[dataSetLength] = {
          "../faces/s1/1.pgm",
          "../faces/s1/2.pgm",
          "../faces/s1/3.pgm",
          "../faces/s1/4.pgm",
          "../faces/s1/5.pgm",
          "../faces/cars/1.jpg",
          "../faces/cars/2.jpg",
          "../faces/cars/3.jpg",
          "../faces/cars/4.jpg",
          "../faces/cars/5.jpg",
      };
  
      float **res = new float* [dataSetLength];
      for(int i = 0; i &lt; dataSetLength; i++)
      {
          std::cout&lt;&lt;names[i]&lt;&lt;"\n";
          cv::Mat img = cv::imread(names[i], 0);
          res[i] = getHOG(img, veclen);
      }
      *setlen = dataSetLength;
      return res;
  }
  
  void test()//Training and activate SVM
  {
      int setlen, veclen;
      float **trainingData = getTraininigData(&amp;setlen, &amp;veclen);
      float *labels = new float[dataSetLength];
      for(int i = 0; i &lt; dataSetLength; i++)
      {
          labels[i] = (i &lt; dataSetLength/2)? 0.0 : 1.0;
      }
      cv::Mat labelsMat(setlen, 1, CV_32FC1, labels);
      cv::Mat trainingDataMat(setlen, veclen, CV_32FC1, trainingData);
  
      cv::SVMParams params;
      params.svm_type    = cv::SVM::C_SVC;
      params.kernel_type = cv::SVM::LINEAR;
      params.term_crit   = cv::TermCriteria(CV_TERMCRIT_ITER, 100, 1e-6);
      std::cout&lt;&lt;labelsMat&lt;&lt;"\n";
  
      cv::SVM SVM;
      SVM.train(trainingDataMat, labelsMat, cv::Mat(), cv::Mat(), params);
      cv::Mat img = cv::imread("../faces/s1/2.pgm", 0);//sample from train data, but ansewer is 1 for every sample
      auto desc = getHOG(img, &amp;veclen);
      cv::Mat sampleMat(1, veclen, CV_32FC1, desc);
      float response = SVM.predict(sampleMat);
      std::cout&lt;&lt;"resp "&lt;&lt; response&lt;&lt;"\n";
  }
  </code></pre>
  
  <p>What wrong with my code ?</p>
  
  <p>PS sorry for my writing mistakes. English in not my native language</p>