title: SVM on OpenCV Mat Error (train data must be floating-point matrix)
body: <p>i'm trying to do a training using OpenCV and SVM.
  But i have a problem, precisely this error:</p>
  
  <pre><code> OpenCV Error: Bad argument (train data must be floating-point matrix) in cvCheckTrainData
  </code></pre>
  
  <p>I have to do a train in a dataSet of images where every images has 68 point (X,Y) that i use to do SVM.</p>
  
  <p>In the beginning this was my code :</p>
  
  <pre><code>//for each image
  fin_land.open(str_app); assert(fin_land);
  for (int i=(0+(68*count_FOR)); i&lt;(num_landCKplus+(68*count_FOR)); i++) {
      fin_land &gt;&gt; f1;
      fin_land &gt;&gt; f2;
      int data[2] = {(int)f1, (int)f2};
      Mat actual(1, 2, CV_32FC1, &amp;data);
      trainData.push_back(actual);
  }
  // SVM
  CvSVMParams params;
  params.svm_type    = CvSVM::NU_SVC;
  params.kernel_type = CvSVM::POLY;     
  trainData = trainData.reshape(1, #numImage);
  SVM.train(trainData, trainLabels, Mat(), Mat(), params);
  </code></pre>
  
  <p>The problem with this code was that i thought to use a Mat for the test with 68 row and 2 columns, because every training-class in my SVM has 2 columns, but i received this error :</p>
  
  <pre><code>OpenCV Error: Incorrect size of input array (Input sample must be 1-dimensional vector) in cvPreparePredictData
  </code></pre>
  
  <p>If I have correctly understood, the problem was that the dimension of the test Mat need to be only one dimensional. So, i thought to modify my code like this:</p>
  
  <pre><code>//for each image
  fin_land.open(str_app); assert(fin_land);
  for (int i=(0+(68*count_FOR)); i&lt;(num_landCKplus+(68*count_FOR)); i++) {
      fin_land &gt;&gt; f1;
      fin_land &gt;&gt; f1;
      int data = (int)f1;
      trainData.push_back(&amp;data);
      data = (int)f2;
      trainData.push_back(&amp;data);
  }
  </code></pre>
  
  <p>Now every training-class has only one column, so even the Mat of test, but I have a new error and it says:</p>
  
  <pre><code> OpenCV Error: Bad argument (train data must be floating-point matrix) in cvCheckTrainData
  </code></pre>
  
  <p>The problem is that the type of the new mat of trainingSet is wrong?
  I don't know how to fix it...</p>