title: Emgu Train SVM for people detection - C#
body: <p>I searched the web a lot and couldn't find any simple solution.</p>
  <p>I'm trying to create a people detector, for this project i chose the Emgu library.</p>
  <p>For now i'm able to detect persons but with no good percentage of success.</p>
  <p>I'm trying to train my SVM, i saw on this post: <a href="https://stackoverflow.com/questions/10769519/svm-classifier-based-on-hog-features-for-object-detection-in-opencv">SVM classifier based on HOG features for “object detection” in OpenCV</a> the process i need for training:</p>
  <blockquote>
  <p>Step 1) Prepare some training images of the objects you want to detect (positive samples). Also you will need to prepare some images with no objects of interest (negative samples).</p>
  <p>Step 2) Detect HOG features of the training sample and use this features to train an SVM classifier (also provided in OpenCV).</p>
  <p>Step 3) Use the coefficients of the trained SVM classifier in HOGDescriptor::setSVMDetector() method.</p>
  </blockquote>
  <p>I have some training images and i'm using this lines of code to extract HOG features:</p>
  <pre><code>public static Image&lt;Bgr, Byte&gt; Resize(Image&lt;Bgr, Byte&gt; im)
      {
          return im.Resize(64, 128,   Inter.Linear);
      }
      public static float[] GetVector(Image&lt;Bgr, Byte&gt; im)
      {
          HOGDescriptor hog = new HOGDescriptor();    // with defaults values
          Image&lt;Bgr, Byte&gt; imageOfInterest = Resize(im);
          Point[] p = new Point[imageOfInterest.Width * imageOfInterest.Height];
          int k = 0;
          for (int i = 0; i &lt; imageOfInterest.Width; i++)
          {
              for (int j = 0; j &lt; imageOfInterest.Height; j++)
              {
                  Point p1 = new Point(i, j);
                  p[k++] = p1;
              }
          }
  
          return hog.Compute(imageOfInterest, new Size(8, 8), new Size(0, 0), p);
      }
  </code></pre>
  <p>But i couldn't find how could i train my SVM (step 2 on the steps above).</p>