title: How to get the separating hyperplane in OpenCV SVM?
body: <p>I am trying to get the hyperplane associated with an SVM. For simplicity sake, let use assume the <a href="https://github.com/Itseez/opencv/tree/master/samples/cpp/tutorial_code/ml/introduction_to_svm" rel="nofollow">example in OpenCV's page</a>.</p>
  
  <p>Here, they are constructing an "image" using a collection of sample outputs in the following way:</p>
  
  <pre><code>// Show the decision regions given by the SVM
  Vec3b green(0,255,0), blue (255,0,0);
  for (int i = 0; i &lt; image.rows; ++i)
  {
      for (int j = 0; j &lt; image.cols; ++j)
      {
          Mat sampleMat = (Mat_&lt;float&gt;(1,2) &lt;&lt; j,i);
          float response = svm-&gt;predict(sampleMat);
  
          if (response == 1)
              image.at&lt;Vec3b&gt;(i,j)  = green;
          else if (response == -1)
              image.at&lt;Vec3b&gt;(i,j)  = blue;
      }
  }
  </code></pre>
  
  <p>The line between the green and blue classes is shown as the separating hyperplane. </p>
  
  <p>Now, my question is: how do I obtain this line as a vector of points or a cv::Mat to do further processing?</p>